mongoobject

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

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

npm install mongoobject
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');