mongoose-plugin-encode-keys
v1.1.1
Published
[![npm version](https://img.shields.io/npm/v/mongoose-plugin-encode-keys.svg)](https://www.npmjs.com/package/mongoose-plugin-encode-keys) [![license](https://img.shields.io/github/license/mgcrea/mongoose-plugin-encode-keys.svg?style=flat)](https://tldrleg
Downloads
74
Readme
mongoose-plugin-encode-keys
Add support for unsafe chars inside MongoDB field names (like .
or keys starting with $
)
Quickstart
- Load the plugin inside your schema
import {Schema} from 'mongoose';
import encodeKeysPlugin from 'mongoose-plugin-encode-keys';
const schema = new Schema({
name: {type: String, required: true},
content: {type: Object, default: {}}
});
// Support exotic payload keys
schema.plugin(encodeKeysPlugin, {fields: ['content']});
export default schema;
Testing
- You can quickly start hacking around
git clone -o github [email protected]:mgcrea/mongoose-plugin-encode-keys.git
cd mongoose-plugin-encode-keys
npm i
npm test