I just started to integrate the Couchbase-lite in my Android and iOS mobile apps and it’s awesome. Just from the traditional mind-set, are there Table (SQL) Collection (NoSQL) like structure available in Couchbase-Lite?
My database has various form records like User Profile, User Favorite. I do understand in the NoSQL sort of world all is possible. However, I want to keep different sort of records as different. Is that possible in CouchbaseLite? If not, is it advisable to keep multiple-databases for various form of records?
It’s up to you how you want to do this. The most typical pattern is to assign a document type field as part of your json. It’s not necessary (or even beneficial) to keep multiple databases.
Take a look at this tutorial for some examples: http://docs.couchbase.com/tutorials/travel-sample-mobile.html?lesson=05-data-model
Thank you. Yes; I do the same way of adding one field in JSON and I use that to filter. I was thinking having table or multiple -database would be more efficient and faster to get specific data because filtering from all sort of data by field would be slower than filtering from a specific database or table. Trust you agree.
In Couchbase, a database is a logical collection of JSON documents. Loosely, think of each document representing a record in a table.
As Hod mentioned, you don’t need multiple databases/ buckets to do what you want to achieve. you can assign a “type” property to each document that would represent the type of document. In your case, that type property could be assigned value of " User Profile", “User Favorite” and so on.
So when you query, you will filter on specific property. There are indexes that you can create to speed querying.
This blog post would be a good read.