Sunday, 11 June 2017

How to remove left-over ObjectId?

The problem is:

I have a collection of photos schema and likes schema, and inside photos there is an array of like ObjectIds called likeArray which is used to populate data from likes colletion.

But when i delete a like from likes collection, the ObjectId of that like in the likeArray still exists.

I tried to find the index of like._id in the likeArray and use likeArray.splice(index, 1) but couldn't work.

Can someone know the solution?



via Hữu Linh

No comments:

Post a Comment