Skip to content

Instantly share code, notes, and snippets.

@hunterloftis
Created June 20, 2012 17:52
Show Gist options
  • Save hunterloftis/2961179 to your computer and use it in GitHub Desktop.
Save hunterloftis/2961179 to your computer and use it in GitHub Desktop.
mongoose minimize schema option
var Profile = new mongoose.Schema({
// ... properties all around this omitted
fixed : {
displayname: { type: String },
birthday: { type: Date }
}
}, {strict: true, minimize: false});
// ...used findOne() to retrieve `req.profile`
console.log("Mongoose:", req.profile.fixed); // {}
console.log("Object:", req.profile.toObject({ minimize: false }).fixed); // undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment