mongodb - MongoCollection How to get grand children? -


the below query works fine , fetches departments , associations.

mongocollection.findone("{name: '"+name+"'}, children: ['departments',  'associations']").as(employee.class); 

i have sub-children each department - items retrieve along same.

not sure how retrieve above query..

tried below doesn't work...

mongocollection.findone("{name: '"+name+"'}, children: ['departments',  'associations', 'departments.items']").as(employee.class); 
  1. how retrieve grand children automatically?
  2. how retrieve grand json elements?

thanks in advance.

example document reference.

users.json

{   "_id":objectid("577a3f7b4309be18d8c40121"), "name":"admin", "email":"admin.guna@gmail.com", "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")   } ] } 


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -