I have a collection as follows:
{ "_id" : ObjectId("4c9c63a95d765f996ca8dff4"), "count" : "28", "id" : "5565", "person" : [
{
"id" : "5435df",
"name" : {
"fn" : "abc",
"ln" : "xyz"
},
"sex" : "m",
"location" : {
"country" : "india"
}
},
{
"id" : "dfg434",
"name" : {
"fn" : "def",
"ln" : "pqr"
},
"sex" : "f",
"location" : {
"country" : "india"
}
}
.
.
.
]
}
the person is an array, with mentioned fields. i wish to find people with a particular id AND country. only those "people" records should be returned. How do i go about doing that? I am using java. Is the structure correct? Should I change the array structure, into something else?
thanks.
EDIT: How do access rules change when brackets change, in this case, i have used [], where i could have used {}. what changes?