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 ?
The syntax is OK.
But, notice, that ‘req.params.teamMember’ param is of string type, but ‘_id’ that you are trying to match is of type ObjectId. You cannot match ObjectId value with a string. Nothing matched - nothing updated.
You need to convert teamMember to ObjectId to do a successful match: