Mongo update operators on regular objects

this might sound strange but I’d like to use mongo style operations on regular objects. Specifically, the update operators like $set, $push, etc.

Something like

sourceObject = {foo: {bar: false}}
mUpdate(sourceObject, {$set {{'': 'baz'}})

// sourceObject is now {foo: {bar: 'baz'}}

Is there an easy way to accomplish this?

minimongo can probably handle this; haven’t tried it though.

meteor add minimongo

then try:

var sourceObject = {foo: {bar: false}}
var operator = {$set: {'': 'baz'}}
LocalCollection._modify(sourceObject, operator);
// {foo: {bar: 'baz'}}

Perfect! Works like a charm.