How should I interact with couchbase.
Hello, I'm developing a 'system' that is available via web browser and android, I'm using couchbase server to store documents in the web application and couchbase mobile with android. To make the sync of these applications I'm using the couchbase sync, but I have a few questions about it.
How should I develop my application?
- Should I use the couchbase lib available for nodejs/android and manage the documents in the 'default' bucket and then use the shadow feature of couchbase sync to replicate?
- Should I use the couchbase sync REST API to manage my documents and store them using the sync bucket as the main (and only) bucket?
- Should I use the sync bucket as the main bucket and manage the documents via the couchbase lib (node/android) instead of the REST API?
- Does the couchbase lib (node/android) works well with a sync bucket or it's better to use the API?
I'm really at a loss here.
Your two options are
(a) Write your web-app using the Sync Gateway REST API to interact with the database;
(b) Use the bucket-shadowing feature and have your web-app operate on the main bucket, while the Gateway uses the shadow of that bucket to sync with clients.
Option (a) will use fewer resources, since bucket shadowing creates duplicate copies of the data. But option (b) may be more attractive to developers who are already familiar with the Couchbase Server APIs and want to use those.