Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.jshintrc
.travis.yml
LICENSE
Makefile
Readme.md
index.js
package.json

Readme.md

Usage

Build Status

var MongoDB = require('backbone-db-mongodb');
var Model = require('backbone-promises').Model;
var store = new MongoDB(mongoClient);

var MyModel = Model.extend({
  db: store,
  sync: store.sync,
  mongo_collection: 'mymodels'
});

var a = new MyModel({id:"1", "data":123});

a.save().then(function() {
  var b = new Model({id:1});
  return b.fetch().then(function() {
    console.log(a.get("data"),b.get("data"));
  });
}).otherwise(console.error.bind(console));
Something went wrong with that request. Please try again.