This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var native = mongoose.Document.prototype.toObject; | |
module.exports = function(schema/* options [could make it safer :)]*/) { | |
schema.methods.toObject = function() { | |
var _this = this; | |
var obj = mongoose.Document.prototype.toObject.apply(this, arguments); | |
var extraneous = Object.keys(this).filter(function(key) { |