Start a new topic

What is the best way to store and load hierarchies/relationships in the Data Store?

My app contains a hierarchy of objects:


---- Object2

-------- Object3

------------ Object4

---------------- Object5

-------------------- Object6

I was able to store this hierarchical structure using KinveyReferences. When I tried to retrieve Object1 and resolve the references, I could see Object1 and Object2, but the reference to Object3 (and the rest of the objects, number 4-6) was not resolved. Is this expected behavior? What is the best way to store and load large hierarchies?
1 Comment

Since we use MongoDB, which is a NoSQL, non-relational database, our relational data capabilities are limited. For example, we only support resolving a maximum of 200 entities per request, and at a maximal resolution depth of 2. This maximum depth is the reason only Object2 was resolved, and not Object3.

Instead, we recommend that the data be remodeled in a less normalized fashion-- for example, if it is possible for each object to actually contain the nested objects instead of references to them, that is the recommended approach. For a more in-depth look at modeling relationships in NoSQL databases, please check the following blog post:

Additionally, there are many articles and guides on the web detailing the different approaches one should take when modeling your data for NoSQL databases.
Login or Signup to post a comment