I have a collection like User having list user and that user have list of user. Like hierarchy.
{
"_id" : ObjectId("55530326bc687d21783fd1ff"),
"Name" : "User 1",
"Role" : "Manager",
number:NumberLong(0),
"1" :
[
{
"_id" : ObjectId("55530326bc687d21783fd1fd"),
"Name" : "User 2",
"Role" : "Ass Manager",
number:NumberLong(0),
"1" :
[
.......
]
}
{
"_id" : ObjectId("55530326bc687d21783fd1fq"),
"Name" : "User 2",
"Role" : "Ass Manager",
number:NumberLong(1),
"1" :
[
.........
]
},
{
"_id" : ObjectId("55530326bc687d21783fd1fg"),
"Name" : "User 3",
"Role" : "Ass Manager",
number:NumberLong(2),
"1" :
[
........
]
}
],
"2" :
[
{
"_id" : ObjectId("55530326bc687d21783fd1fw"),
"Name" : "User 4",
"Role" : "Specialist",
number:NumberLong(0),
"1" :
[
.......
]
}
{
"_id" : ObjectId("55530326bc687d21783fd1fe"),
"Name" : "User 5",
"Role" : "Specialist",
number:NumberLong(1),
"1" :
[
.........
]
},
{
"_id" : ObjectId("55530326bc687d21783fd1fr"),
"Name" : "User 6",
"Role" : "Specialist",
number:NumberLong(2),
"1" :
[
........
]
}
]
}
The above is just one collection for sample, like this i have nearly 10000 document. I need to find the collection which have 'number' as 0. Even if any one embedded document have 'number' as 0 I want that document.
Note : I can't tell how many child will come for a user.