0

From: Couchbase Sync Gateway

I have some questions of the same subject.

Since last answer, things change and there is a tutorial for sync user data

https://docs.couchbase.com/userprofile-couchbase-mobile/current/userprofile/userprofile_sync.html

This example show how to sync only one document per user (like user profile), so only one bucket is needed for all user.

So my question:

In case of multiple documents per user (like a list of event), do I need to create a bucket per user? Or can I use the same way as the example?

Using channel is a good idea? https://docs.couchbase.com/sync-gateway/current/channels.html

Also, what can be the size/usage of the database for this?

Thanks

François

1 Answer 1

1

Channels is the right answer here. You could add an attribute called "channels" to your document:

{ username: "John" channels: ["john_channel_id_here", "someOtherOptionalChannel"] } 

And on your mobile app, after you authenticate the user called "John", you could subscribe to the channel "john_channel_id_here".

If the document has an attribute called "channels", it will automatically put it on the channels described in the array. It is an easy way to add support for dynamic channels.

There are more complex ways of how you can use channels, but this approach is good enough to get started.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I made a proof of concept with channel and it's confirming your answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.