Skip to content

Tag: mongoose

Moongose after find, object.map is not returning key

I have a code that after find and populate, I will then add a new key (‘order_date’) based on createdAt. I have checked with console.log(i.createdAt), it do have the date element in the i, but when I do console.log(orders), it is not retunring me order_date. Is it caused by the async await functio…

Mongoose update Sub-Document

How to updating sub-document in mongoose: this is my JSON DATA This is the post Schema. this is the NodeJs part ** I got this response in Postman: post.comments.update is not a function it accept post.update but it’s not what i want because the property message is in the sub-doc of each post object, any…