More than 30 (Maximum) Buckets per cluster


I have been evaluating the couch base server and its mobile SDK for the use case of our product. As the initial stage evaluation process I went some of the key concepts and the way of how couch base server works. Which leads to the limitations of the couch base server.

Our product currently requires 120 buckets for one of our customer. We have currently used CouchDB, where we can have n number of buckets based on our requirement, just we have match instance/server ROM, Cores and Size.

In the process we need couple of clarification

  1. What should be the server and cluster configuration in terms of system for the 30 buckets
  2. Is it possible to have more buckets in the cluster? If it is possible what should be the system configuration required to support that number?

Hi @naveenkumar.hs
Perhaps the new support for scopes and collections in Couchbase 7.0 would be useful for your requirements? You can have up to 1000 collections per cluster. Please see the documentation for more details.

Thanks @graham.pople for the quick response.

Looking at the documents we need one more clarification.

In a single Couch Base Server Bucket Can we store same Json document multiple times as part of two different collections that are in different scopes or same scope.

Document goes into specific collection.

Same JSON document can be stored in different collection with same key. If need to store in same collection you must use different key (key is unique in the collection).

bucket1.scope1.coll1    Key "k01"     doc {"a":1}
bucket1.scope1.coll1    Key "k01"     doc {"a":1}   -- not allowed violates key  (you can change key it allowed)

bucket1.scope1.coll2    Key "k01"     doc {"a":1}  -- Allowed
bucket1.scope2.coll1    Key "k01"     doc {"a":1}  -- Allowed
bucket2.scope1.coll1    Key "k01"     doc {"a":1}  -- Allowed

Thanks @vsr1 for the response,

Regarding the above concept I need one more clarification.

Can we do Join queries on Json docs across different scope and collections?

Yes. JOINs are allowed all combinations. JOIN Clause | Couchbase Docs

bucket.scope.collection in Couchbase are analagous to database.schema.table in an RDBMS.

FYI: You can’t select all the documents in bucket (scopes,collections), you can’t select all documents in scope (all connections). You need separate queries or do UNION ALL explicitly

Thanks @vsr1,

You have clarified all the doubts we have regarding the Couch Base Server. Thanks a lot for your time .

In the end I have one small question.
Is Collections and Scopes concepts also present in Couch Base Lite especially in Android and iOS SDKs?

@priya.rajagopal will able to answer this.

Only default scope and collection is supported at this time. Support for User defined scopes and collections is on our product radar but it is not available today.

Thanks @priya.rajagopal,

Is it possible to point the Couch Base Lite to sync with different scope and collections ?
How will these different scope and collection data will differentiated in the Couch Base Lite i.e, mobile?
If we create one data from mobile to which scope and collection will it sync?

As indicated above, couchbase lite/ Sync Gateway only supports default scope and collection at this time. So it will be synced to the default scope (and _default collection) on server side.
You mentioned 120 buckets. Do all buckets need to be synced to a mobile client? I suspect not. As suggested, If you consolidate the bucket into scopes (and collections), you can keep the “Mobile aware” data in _default scope.
With the _default scope, the typical pattern for data segregation is to use a “type” identifier in documents and associate each type of document with a sync gateway channel.
In future, when sync gateway and couchbase lite is collection-aware, you can migrate mobile documents into user defined scopes.