json - Getting subdocument by ObjectID directly in mongodb -


having structure:

/* 0 */ {     "_id" : objectid("53f1f19a477aa5da607b20a4"),     "name" : "anna" }  /* 1 */ {     "_id" : objectid("53f1f192477aa5da607b20a3"),     "name" : "josh",     "mother" : objectid("53f1f19a477aa5da607b20a4") } 

is possible complete document of mother instead objectid. mean, if query: db.tree.find({"name" : "josh"}) document of josh, not able name of anna because should query. it's possible in mongodb complete tree/json of documents when 1 of field refering document avoid multiple queries?

for clarity: mongodb not joins - resolving mother objectid document requires second query. antoniootero pointed out, drivers , orms, mongotemplate or mongoose, reference resolution you, automatically or request. should aware results in multiple database queries, however.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -