The below query works fine and fetches departments and associations.
MongoCollection.findOne("{name: '"+name+"'}, children: ['departments',
'associations']").as(Employee.class);
I have sub-children for each department - items which i would like to retrieve along with the same.
Not sure how to retrieve with the above query..
Tried the below but it doesn't work...
MongoCollection.findOne("{name: '"+name+"'}, children: ['departments',
'associations', 'departments.items']").as(Employee.class);
1. How to retrieve the grand children automatically?
2. How to retrieve the grand json elements?
3. How to query via Objects instead of using string in the above example?
Example Document for reference.
Users.json
{
"_id":ObjectId("577a3f7b4309be18d8c40121"),
"name":"admin",
"firstName":"guna",
"lastName":"g",
"password":"bevgI3awgpagF2o6ekUObEQ14UmdskWpG",
"roles":[
{
"name":"sales",
"description":"sales",
"_id":ObjectId("577a3f7b4309be18d8c40122")
}
]
}
Roles.json
{
"_id":ObjectId("577a3f7b4309be18d8c40122"),
"name":"sales",
"description":"sales",
"permission":[
{
"name":"SalesView",
"description":"SalesView",
"_id":ObjectId("577a3f7c4309be18d8c40123")
}
]
}