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)
$ npm install mongoose-sanitize-json
var mongoose = require('mongoose');
var sanitizeJSON = require('mongoose-sanitize-json');
var personSchema = mongoose.Schema({
name: String,
age: Number
});
personSchema.plugin(sanitizeJSON);