Overrides for Backbone to use MongoDB for Model persistence. Intended for server-side use of Backbone like in Bones.
npm install bones-mongodb
var Backbone = require('backbone');
// Create a new bones-mongodb handler for a database 'documents'.
var mongo = require('bones-mongodb')({
host: '127.0.0.1',
port: '27017',
name: 'documents'
});
// Create database and assign sync method to Backbone.
mongo.install(function(err) {
Backbone.sync = mongo.sync;
});
// Backbone.sync will now load and save models from a 'documents' mongo db.
new Collection().fetch({
filter: {
name: 'Sergey'
}
})
cd bones-mongodb/
npm test