Note that there are some explanatory texts on larger screens.

plurals
  1. POMongoDB Embedded object creation in Java without morphia.
    primarykey
    data
    text
    <p>I am very new to mongodb and tryn to use it for developement. I have a conceptual model of: <br/>User={"uid":"", "services":"[ <br/><code></code>{ <br/><code></code>"serviceid":"sid",<br/> <code></code>"sub_dat":"somedate",<br/> <code></code>"exp_date":"somedate",<br/> <code></code>}, <br/><code></code>{ <br/><code></code>"serviceid":"sid",<br/> <code></code>"sub_dat":"somedate",<br/> <code></code>"exp_date":"somedate",<br/> <code></code>},<br/> <code></code>{ <code></code>"serviceid":"sid",<br/> <code></code>"sub_dat":"somedate",<br/> <code></code>"exp_date":"somedate",<br/> <code></code>},<br/> ]", <br/>"friends":"[ <br/><code></code>{ <br/><code></code>"friend_id":"", <br/><code></code>"friendname":"name" <br/><code></code>"friendshipyrs":"yrs", <br/><code></code>},</p> <p><code></code>{ <br/><code></code>"friend_id":"", <br/><code></code>"friendname":"name" <br/><code></code>"friendshipyrs":"yrs" <br/><code></code>},</p> <p><code></code>]", <code></code>}</p> <p>I wish to know the steps to follow in java with the raw driver, not morphia to, to: 1. create this object, such that i have the ability to: 2. fetch and append new services and friends to the service lists.</p> <p>I can currently add to the top level and I tried using the BasicDBObject, DBList, and even the ObjectBUilder but could not figure out how to append or push into the fields to create the arrays/lists with the java driver as can be seen from the presentations on the 10gen site.</p> <p>Also, want to be able to drill down to say.. friend info with a single query, so will it be advisable maintain above structure or create friends as a class and put the class objects in the list? I know of the dot operator, but i do not know how to access class fields through the java driver.</p> <p>Will be very greatful for any help... Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload