Reputation: 449
{
"_id":"12345",
"model":{
"T":0,
"serviceTask":[
{
"_id":"6789",
"obj":{
"params" :{
"action": "getEmployeeData",
"employeeId":"123"
},
"url":"www.test.com",
"var":"test",
},
"opp":100
}
]
}
}
I have similar structured documents in my collection. How do I query the documents that match action value to "getEmployeeData"
. I tried dot notation with $elemMatch
but couldn't get the results.
Upvotes: 1
Views: 49
Reputation: 49945
Dot notation works fine here, it will return the document if serviceTask
contains at least one action
set to getEmployeeData
db.collection.find({
"model.serviceTask.obj.params.action": "getEmployeeData"
})
Upvotes: 2