Rahul Bishnoi
Rahul Bishnoi

Reputation: 1

I'm working on my project and facing a problem in deleting a element in an array of objects

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 .

here is the img of code enter image description here

Upvotes: 0

Views: 28

Answers (1)

Tornike Skhulukhia
Tornike Skhulukhia

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

Related Questions