mongoose-sanitize-json
v2.0.0
Published
Mongoose plugin to replace _id by id and remove __v, __t when toJSON is called on a mongoose document
Downloads
156
Readme
mongoose-sanitize-json
This plugin removes the following fields "_id, __v, __t" and published virtuals "id" when the document is converted to json. (Note other virtual fields will also be published)
Installation
$ npm install mongoose-sanitize-json
Usage
var mongoose = require('mongoose');
var sanitizeJSON = require('mongoose-sanitize-json');
var personSchema = mongoose.Schema({
name: String,
age: Number
});
personSchema.plugin(sanitizeJSON);