Property 'pull' does not exist on type 'ObjectId[]'
I want to remove from an Array list and this is the error I am getting when I tried to use the method, please how do i resolve this error ?
3 Replies
never seen pull before
not as a function at least
you can use update instead and inside the update add the
$pull
property mongo has
it seems to me that is used for sub-documents not just any arraypull only exists for document arrays not arrays of object ids
what you need is more along the lines of
mydocument.updateOne({userId: someId}, {$pull: {favorites: {_id: favoriteId} } })