mongosync

A Backbone.Sync replacement for persisting data on the backend using MongoJS

MongoSync

A drop-in Backbone.Sync replacement for persisting data on the backend.

More info

npm install mongosync

or

bower install mongosync

You'll need to shim this to get it working with RequireJS (like you did jQuery & Backbone already)

requirejs.config({
    paths: {
        'jquery': 'path/to/jquery',
        'underscore': 'path/to/underscore',
        'backbone': 'path/to/backbone',
        'mongosync': 'path/to/mongosync'
    },
    shim: {
        'backbone': {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        },
        'mongosync': {
            deps: ['backbone'],
            exports''SharedModel'
        },
        'underscore': {
            'exports''_'
        }
    }
});

Then in your code:

define(function(require){
    var Model = require('mongosync');
 
    var MyModel = Model.extend({});
 
    return MyModel;
});
<!-- script tags for backbone and underscore appear here -->
<script src="bower_components/mongosync/mongosync.js"></script>

Then in your code:

    var MyModel = SharedModel.extend({});

npm install

Uses grunt to handle development tasks. All grunt tasks are available via npm run using a locally installed copy of grunt-cli.

npm test to run unit tests

MongoSync is provided under the terms of the MIT License