MongoDB model plugin for Fend.js
$ npm install fendjs-model-mongo
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) {
// ...
});
});
});
Extend mongorable model plugin constructor.
Connect mongodb.
Disconnect mongodb.
$ npm install
$ make test
See the LICENSE
.