I have a document structure as follows:
{
"field1": "value",
"field2": "value",
"items": [
{
"inField1": "value1",
"inField2": "value2",
"votes": {
"count": 2,
"people": [
{
"username": "user1",
"image": "http://image/to/user1/profile.jpg"
},
{
"username": "user2",
"image": "http://image/to/user2/profile.jpg"
}
]
}
},
{
"inField1": "value3",
"inField2": "value4",
"votes": {
"count": 1,
"people": [
{
"username": "user1",
"image": "http://image/to/user1/profile.jpg"
}
]
}
}
]
}
Now I need all item(single Object of items field) where in any people property of votes property has a username as user1?
In above mentioned example it should return both the items, as both of them contain user1 in username property, but if I search for user2 then onl the first item should be returned.