Hello, I’m just starting with couchbase and have a usage question:
consider the tutorial here where there are people and their children stored in a nested array. In my use case, I have just a handful of people, but all of them have many children (let’s say up to 100k). Each child is a simple JSON, with an id and some more params, but not much more nesting.
the hierarchy, simply put in code is like this:
let mutableDocument = findOrCreateParentDocument(parentId: parentId)
for child in childrenDictionary {
let childObject = MutableDictionaryObject(data: child)
mutableDocument
.array(forKey: "children")!.addDictionary(childObject)
}
I have two questions: (1) Is the model where each person has a nested array of this size a good way to model such data (I’m a little worried about perf).
(2) the children will be gradually added to the DB in small batches and I later need to query the children to display them, and will also be doing so in batches (say 400 children). In queries, is there any way to use offset and limit on the nested children (to look at just a part of the entire children array)? Or would it be better to store each child as a separate document and some use joins? Thanks in advance!