MongoDB model plugin for Fend.js
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
.travis.yml
HISTORY.md
LICENSE
Makefile
README.md
TODO.md
package.json

README.md

fendjs-model-mongo

Build Status Coverage Status NPM version Dependency Status

MongoDB model plugin for Fend.js

Installing

$ npm install fendjs-model-mongo

Usage

var Modeler = require('fendjs-model');
var Mongorable = require('fendjs-model-mongo');

Mongorable.connect({
  database: 'test',
  host: 'localhost',
  port: 27017
}, function (err) {
  Modeler.use(Mongorable());
  var Pet = Modeler('Pet')
    .attr('id')
    .attr('name');

  var pet = new Pet({ name: 'Tobi', species: 'Ferret' });
  pet.save(function (err, res) {
    if (err) {
      // Error something todo ...
      return;
    }
    // Something todo ...

    Mongorable.disconnect(function (err) {
      // ...
    });
  });
});

API

Mongorable()

Extend mongorable model plugin constructor.

Mongorable.connect(options, fn)

Connect mongodb.

Mongorable.disconnect(fn)

Disconnect mongodb.

Testing

$ npm install
$ make test

License

MIT license.

See the LICENSE.

Bitdeli Badge