Skip to content
A NodeJS library which can parse Mongo update modifier command and apply them to local objects
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
.travis.yml test out travis Jan 26, 2012
README.md
package.json

README.md

mupdate Build Status

A NodeJS library which can parse Mongo update modifier command and apply them to local objects.

Installation

Installing npm (node package manager)

curl http://npmjs.org/install.sh | sh

Installing mupdate

npm install mupdate

Example Usage

var mupdate = require('mupdate')
var local = {
    'foo': 'bar',
    'nesting': {
        'keys': 'so',
        'I': ['can', 'use'],
        'dot': {
            'syntax': 'like a boss',
        },
    },
};

var update = {
    '$set': {
        'foo':'bar none',
    },
    '$push': {
        'nesting.I': 'pithy',
    },
}

// mupdate.update updates the original in-place and returns it with changes
// applied.
console.log(mupdate.update(local, update));
console.log('===');
console.log(local);
Something went wrong with that request. Please try again.