Reputation: 551
I am using mongodb and mongoose. Some of the properties of the document schema that I use have defaults which are set when the document is saved. I intend to read these properties after calling the save()
function of a document instance. However, the save()
does not seem to apply the change to the document instance:
doc.save();
console.log(doc.somePropertySetByDefault); // undefined
Is there a way how one can do that without writing an entire query (i.e. Doc.findOne(...)
)?
Upvotes: 1
Views: 353