Skip to content

gobengo/mongo-object-escape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongo-object-escape

Mongo cannot store documents that have '$' or '.' in keys.

The docs encourage replacing with the Unicode full-width equivalents U+FF04 (i.e. “$”) and U+FF0E (i.e. “.”).

This library escapes and unescapes the keys of an object according to that convention, returning a new object from each.

See the tests for examples.

API

var mongoObject = require('mongo-object-escape');
var escapedDocToWrite = mongoObject.escape(userInput);
var unescapedDocToRead = mongoObject.unescape(escapedDocToWrite);

About

Escape Mongo documents that have '$' or '.' in keys.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published