2.0.0 • Published 6 years ago

mongoose-sanitize-json v2.0.0

Weekly downloads
40
License
MIT
Repository
github
Last release
6 years ago

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