I have been read quite a couple of articles and webinars related to Couchbase.
But I am still not so clear about how should I design the relationship between documents…
Say we have User, Product, ProductsViewd (From webinar “How-To NoSQL Couchbase 104: Data Modeling”)
The webinar suggest we should make 3 types of document:
“productsList”: [ 8, 33, 99, 100 ]
By using compounds key, I can predict key for ProductsView of a User.
But here is my questions:
What if the ProductsView document size increasing up to or over the limit of a document 20mbs?
Every load and write operation will be a heavy operation or Couchbase is just fast enough that I don’t have to care about it?
And when by reaching the limit of a document 20mbs, in order to save more data, I will have to create another document for ProductionsView as user::1001:productsviewed::02 to be another list of productviewed?
Also, the webinar suggest about the key should be predictable (the demo code at the end of webinar)
3) But say for example, the post of a user: user:1001:post:1 …user:1001:post:5
What if the post got deleted in the middle?
Then the key is no longer predictable, I will have to end up using a document like ProductViewed to list the posts.
So what is the points to make it predictable? I should only do it if the I know the Post will never got deleted?