Reputation: 1
I'm working on my project and facing a problem in deleting a element in an array of objects ,the mongoose function run without error but the targated element won't delete at all .Help me with the code.
i want to delete the element of document(user) having _id->requestedUser and element having the postId -> requestedPost .
Upvotes: 0
Views: 28
Reputation: 421
Problem may be that you pass requestedPost object directly as postId value, probably you should get exact id of post from it.
Similar example that works https://mongoplayground.net/p/CO5qR1RdbuL
Upvotes: 0