Try to use 5 or less buckets in Couchbase. Never more than 10

Hi,

I have just found out this article about couchbase-> https://blog.couchbase.com/10-things-developers-should-know-about-couchbase/ In point #6 it says Try to use 5 or less buckets in Couchbase. Never more than 10.

That was the only point that caused me a big itch since I’m trying to setup a couchbase system with the following architecture:

I have N apps and U users. Each user has it’s own database in each app. Before reading this I was thinking in the following architecture:

A user will have a bucket for each app. So, if I have 1000 users and 3 apps. there will be 3000 buckets.

But I shouldn’t have more than 10!?

What’s the way to get around this? Because logically I don’t find any other way.

Let’s suppose I keep a single bucket with the data from all the users. Since I want my data to be replicated, the replication of a database will be on every user. That doesn’t make much sense too!

Can you please advise on how to design the data model for this scenario?

Thanks,

Best regards,

Nuno

I recommend looking at how the Couchbase mobile sync gateway handles this. Sync Gateway All user data is stored in one bucket and the sync gateway handles auth and making sure the user only has access to their own data.