xqcore-mongodb
v0.0.7
Published
MongoDB module for xqcore
Downloads
3
Readme
XQNode MongoDB module
Usage
//Set default db connection
require('xqnode-mongodb').conf = {
"host": "myhost.tld",
"port": 17027,
"dbname": "mydb"
};
//Create a MongoDB Model
var Model = require('xqnode-mongodb').Model;
var model = new Model({
collection: 'myCollection'
});
Methods
fetch() Gets a model from DB and sets data to model sync() To be called everytime the model changes its data Thorws an db.error handler if something wents rong with the database