mongoose-sanitize-json

2.0.0 • Public • Published

mongoose-sanitize-json

npm version

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

Package Sidebar

Install

npm i mongoose-sanitize-json

Weekly Downloads

26

Version

2.0.0

License

MIT

Last publish

Collaborators

  • adarshasnah