I'm trying to update array element inside document.
The document looks like this:
{
"_id": "11111ec6de08e20354634b1d",
"firstname": "Israel",
"lastname": "Lavi",
"exams": [
{
"examId": "1000",
"name": "something",
"status": [
{
"status": "created",
"date": "2018-11-09T08:01:46.627Z"
}
]
},
{
"examId": "2000",
"name": "something",
"status": [
{
"status": "created",
"date": "2018-11-09T08:01:46.627Z"
}
]
}
]
}
I want to update exam where examId=1000 I'm using the following command:
collection.update({'_id': _id, 'exams': { $elemMatch : { 'examId': examId } } }, {$set: {'exams.$': lcExam}}, {upsert: true})
And getting the following error:
The positional operator did not find the match needed from the query.
Thanks in advance