New packages to modify objects in minimongo by just submitting updated object


Hi everyone.
Sometimes it’s practical to get an object from the database, modify the object and put it back directly in the database. However minimongo doesn’t allow to do that since collections on the client could be filtered through publications, hence minimongo update operation only allow fields modifications, not objects replacement.

This package solves this problem by adding an extend method to collections on the client, allowing to pass directly the updated object as a parameter.

Under the hood, it use the brother package vjau:jsdiff2mongo that builds the update query.
If you don’t like the idea of adding something to Mongo.Collection.prototype, you can build the query with vjau:jsdiff2mongo and apply it yourself with Mongo.Collection.prototype.apply

Comments welcome !

The packages are here :