I am trying to query a mongodb document without luck. The following query works to get a user whose id is domainOwner and scope is clearcrimson.
db.getCollection("users").findOne( { "roles": { $elemMatch: {_id: "domainOwner", scope: "clearcrimson" } } }, {_id:1})
How can I modify the query to get a user whose one email id could be [email protected], id is domainOwner and scope is clearcrimson?
Document:
{
"_id" : "7Rc5q2o3Qnv7j2HuT",
"emails" : [
{"address" : "[email protected]"},
{"address" : "[email protected]"},
],
"roles" : [
{"_id" : "domainOwner", "scope" : "clearcrimson"},
{"_id" : "domainOwner", "scope" : "clearcrimson2"}
]
}