Choosing between scopes & collections

Hello,

I’m having a difficult time understanding what is the difference between a scope & a collection in couchbase 7.x

I was using Couchbase 6.x for a previous project and will use Couchbase 7.x in a new project.
I believe I already know how bucket works and why pout data in the same bucket or not.
(For example, I have two sets of data:

  • one is small, but frequently updated. I’ll store this in a separate bucket, 100% in memory for fast access
  • the other is much larger, and only the keys recently inserted will be frequently accessed. so for this one, I’ll probably use a bucket with only 10% of the data in memory

Without the scopes & collections, I was using two techniques to differentiate between two types of objects in the same bucket:

  • either with a key prefix or with an added document property specifying the object type

I believe the key prefix/document property could be replaced with the collection or scopes, but I’m having a hard time deciding which one to use

Any guidance or documentation on this topic would be awesome

Thank you

Thomas

Hello @piartt
Ultimately there’s flexibility to use either scopes or collections for your use-case.

In most cases, I’d suggest to replace the bucket paradigm with scopes and key prefixes with collections inside those scopes. Scopes and Collections within a bucket use far less resources than individual buckets in previous releases. Though scopes and collections will not change aspects like resident ratio, so in those cases it would still be appropriate to use separate buckets.

Thanks,
Ian McCloy (Principal Product Manager, Couchbase)

Thank you. I’ll read those articles and try that