mongo-object-escape

0.0.4 • Public • Published

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);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    35
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    35
  • 0.0.3
    1
  • 0.0.2
    0
  • 0.0.1
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i mongo-object-escape

Weekly Downloads

1

Version

0.0.4

License

ISC

Last publish

Collaborators

  • gobengo