2.0.1 • Published 8 years ago
bentojs-api-mongo v2.0.1
Bento.js API Mongo
Installation
$ npm install --save bentojs-api-mongo
Config
Once you have installed and built your API solution you can move into the ./config/mongo
directory and set up the default.js
settings for your project.
module.exports = {
/*
|--------------------------------------------------------------------------------
| Mongo
|--------------------------------------------------------------------------------
*/
mongo : {
host : 'localhost',
port : 27017,
database : null,
force : false
}
};
Model
Create your first model by adding them to the models
folder of your module.
bento.register.model('Foo', 'mongo', model => {
model.filter = function(parse, query) {
return parse(query, {
where : {
name : parse.STRING,
type : parse.STRING
}
}, [ 'name', 'type' ]);
};
return model;
});