I’m trying to remove specific sub document by it’s _id. In eventArrayModel there are plenty of documents. I’m looking for match for origin of sub document by field resource . This is what i come up with, but it doesn’t work. Any ideas ?
const removedPost = await eventArrayModel.update({resource: req.params.teamMember}, {$pull: { array : {_id: ObjectId("5ef0a884c09b8e9ff01c8007")}}});