Query.prototype.lean()
Parameters
bool «Boolean|Object» defaults to true
Returns:
«Query» this
Sets the lean option.
Documents returned from queries with the lean option enabled are plain javascript objects, not MongooseDocuments. They have no save method, getters/setters or other Mongoose magic applied.
Example:
new Query().lean() // true
new Query().lean(true)
new Query().lean(false)
Query.prototype.lean() Parameters bool «Boolean|Object» defaults to true Returns: «Query» this Sets the lean option.
Documents returned from queries with the lean option enabled are plain javascript objects, not MongooseDocuments. They have no save method, getters/setters or other Mongoose magic applied.
Example: new Query().lean() // true new Query().lean(true) new Query().lean(false)
Model.find().lean().exec(function (err, docs) { docs[0] instanceof mongoose.Document // false });
model.toJSON()