node package manager

mongoobject

mongoObject ----------- escapes $ and . in object keys so you can store objects in MongoDb.

mongoobject

escapes $ and . in object keys so you can store objects in MongoDB.

Installation

npm install mongoobject

Usage

var mongoobject = require('mongoobject');
 
var objectToSaveInMongo = mongoobject.escape(myObject);
var mongoobject = require('mongoobject');
 
var myObject = mongoobject.unescape(myObjectFromMongo);
 

You can also escape and unescape just one property name

var escapedPropertyName = mongoobject.escapeKey('$mypropertyName');
 
var unescapedPropertyName = momgoobject.unescapeKey('\uff04myPropertyName');

License

MIT