I have defined a Model with mongoose like this:
var mongoose = require(\"mongoose\")
var Schema = mongoose.Schema
var userObject = Object.create({
alias
That's exactly the purpose of mongoose, wrapping mongo objects. It's what provides the ability to call mongoose methods on your documents. If you'd like the simple object, you can call .toObject()
or use a lean query if you don't plan on using any mongoose magic on it at all. That being said, the equality check should still hold as doc.password
returns doc._doc.password
.