Skip to content

sergeydt/bones-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bones Mongo

Overrides for Backbone to use MongoDB for Model persistence. Intended for server-side use of Backbone like in Bones.

Installation

npm install bones-mongodb

Usage

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.

Filters (mongo queries)

new Collection().fetch({
    filter: {
        name: 'Sergey'
    }
})

Run tests

cd bones-mongodb/
npm test

About

Backbone Mongo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published