mongoobject
v2.0.0
Published
mongoObject ----------- escapes `$` and `.` in object keys so you can store objects in MongoDb.
Downloads
172
Readme
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