We are trying to figure out which data model would be best for saving data to Couchbase when size of the document can get very large.
Save all the data in a single document, with the possible problem of reaching the maximum allowed by Couchbase (https://docs.couchbase.com/server/current/learn/clusters-and-availability/size-limitations.html). The structure of the document would be something like:
{
"id": "x",
"name": "Test 1",
"tokens": [
{
"value": "bad words 1",
"caseSensitive": true,
"whole": true
},
{
"value": "bad words 10",
"caseSensitive": true,
"whole": true
},
[...]
],
"_class": "Document"
}
Save to multiple documents with the id of the parent document as a primary index, so we can do a query of ChildDocuments by parentId:
Parent:
{
"id": "x",
"name": "Test 1",
"_class": "ParentDocument"
}
Children:
{
"id": "y",
"parentId": "x",
"value" "value",
"caseSensitive": true,
"whole": true,
"_class": "ChildDocument"
}
Since db admins tell us that it is not a good practice to add indexes because of their size and performance, the single document option seems to be the only option, but what can be done to avoid reaching the maximum size that Couchbase can support?
Thanks in advance