| Author |
When to nest objects and when to use references
|
Sebastian Barszczewski
Greenhorn
Joined: Feb 19, 2008
Posts: 3
|
|
Hello,
i am new to the whole nosql topic and i was wondering where the differences are between designing classic sql schemas and nosql schemas. I am especially interested in when should i use references and when should i use nested objects? What are the experiences concerning this decision?.
Regards,
Sebastian
|
 |
Askar Akhmerov
Greenhorn
Joined: Apr 13, 2010
Posts: 20
|
|
Hi Sebastian,
from what I've learned about NoSQL, the rule of thumb is : inline everything in the document as long as you don't really need a reference to another collection.
In terms of webapp I would suggest using separate document entity for a screen accessible by user.
Example: Portal page. It has a list of portlets which will probably be a DbRef, however each such page probably has static data like user information, terms and conditions,etc. which can be inlined.
You should also keep in mind that DbRef's will not get updated automatically upon top level entity update. You will have to implement somthing like deep copy mechanics in order to persist that information and always have 1 state of an entity.
|
 |
Sebastian Barszczewski
Greenhorn
Joined: Feb 19, 2008
Posts: 3
|
|
Askar Akhmerov wrote:
You should also keep in mind that DbRef's will not get updated automatically upon top level entity update. You will have to implement somthing like deep copy mechanics in order to persist that information and always have 1 state of an entity.
Thats a good hint. Thank you!
|
 |
 |
|
|
subject: When to nest objects and when to use references
|
|
|