A Backbone.Sync replacement for persisting data on the backend using MongoJS
A drop-in Backbone.Sync replacement for persisting data on the backend.
npm install mongosync
bower install mongosync
MongoSync returns a function which then returns a context-aware Backbone model. It's wrapped in a function so that the sync method can be given the correct db location and collection to use.
It will detect if you're in an AMD situation and provide the appropriate
define for RequireJS. You will also need amdefine in your project.
iftypeof define !== 'function'define = module;;
var SharedModel = 'localhost' 'test';var MyModel = SharedModel;moduleexports = MyModel;
<!-- script tags for backbone and underscore appear here -->
Then in your code:
var MyModel = ;
To install the dependencies:
Uses grunt to handle development tasks. All grunt tasks are available via
npm run using a locally installed copy of
npm test to run unit tests.
You will need a mongodb server running somewhere to run the tests...
MongoSync is provided under the terms of the MIT License