We’re using PouchDB on our React Web App and Chrome Extension to sync with Couchbase Sync Gateway (Capella App Services) and just discovered that custom scopes apparently aren’t supported - only the default scope works with PouchDB sync.Our setup:
- PouchDB (web) → Sync Gateway → Couchbase Capella
- Data organized in custom scopes with multiple collections (tasks, notes, etc.)
Questions:
- Can we use multiple collections within the default scope when syncing from PouchDB?
- If we move everything to the default scope, will collections still work for organizing our data types?
- Are there any downsides to using the default scope (mixing app data with sync metadata, performance, etc.)?
Any help would be appreciated as we are trying to figure out how to get couchbase to work with with React web app.Thank you.
1 Like
- Can we use multiple collections within the default scope when syncing from PouchDB?
A PouchDB database does not have a concept of a collection, this is a Couchbase concept only. If using multiple PouchDB databases for the data separation is OK, it might work to have the remote as :4984/app-endpointA.scopeA.tasks
and :4984/app-endpoint.scopeA.notes
- If we move everything to the default scope, will collections still work for organizing our data types?
I think the issue is really that there is no concept of collections in PouchDB, so :4984/app-endpointA._default._default/
and :4984/app-endpointA/
urls are equivalent.
You can also separate specific data with channels. Under the hood, PouchDB replicates with this API Capella App Services Public API Reference | Couchbase Docs and you can use filter
and channels
to replicate a specific set of channels. I do not know how to translate that into a PouchDB API.
If using a channel filtered replication does not work via those parameters, you can also do a channel filtered replication using separate App Services users that only have access to specific channels.
- Are there any downsides to using the default scope (mixing app data with sync metadata, performance, etc.)?
Sync metadata will not be mixed with user data in any replication. Some sync metadata exists in _default
scope and _default
collection, regardless if App Services is configured to use it or not. The only effect is that there are some documents visible in the Capella UI bucket view with _sync
prefixes.