Hi,
I have this MongoDB document:
And I have this update query that removes som elements from the exams field:
Can someone please tell me how to write a Query with the, awsam ,spring-mongodb query API?
I have this MongoDB document:
Code:
{
"name" : "Joe",
"exams" : [
{
"foo" : "bar",
"exam" : 1
},
{
"foo" : "bar",
"exam" : 2
},
{
"foo" : "bar",
"exam" : 3
}
]
}
{
"name" : "Peter",
"exams" : [
{
"foo" : "bar",
"exam" : 2
},
{
"foo" : "bar",
"exam" : 3
},
{
"foo" : "bar",
"exam" : 4
}
]
}
Code:
db.students.update({"exams.exam": {$in: [2,3]}}, {$pull: {exams: {exam: {$in:[2, 3]}}}}, {multi: true})