Syncing .NET Server with Couchbase lite



I am getting a bit confused wit the number of available APIs and I am not sure how approach this topic.

I will be using Couch DB Lite on android device to sync some state of application form Coach DB . The sync will be read only on Android side - the client will not be allowed to push any data to DB.

Using data provided by CouchDB lite Android Client will be doing REST requests to server written in .NET Core.
The server will be doing its logic and if reqired it will be changing data in Couch DB.

My question here . The change done by server on Couch DB needs to be immediately synced to Android Device (Coutch DB Lite). Which API to use to enforce the instanc sync of Couch DB with Android Device ? SHould this be SyncGateaway’s REST API or something else ? Would posting/updating documment directly to CouchDB( without using Sync Gateaway) will trigger the update on Android side ?
I would prefer not include CouchDB lite to my serer not to duplicate DB.
Important thing is that couch db in my use case is not the main data source it is treated rather like sync tool

I would be grateful for the answer ?



Are you talking about CouchDB or Couchbase ?



Sorry for my ignorance. I thought it is the same. I thought of CouchBase which C can use with CouchBase Sync Gateaway



No pb, I was a beginner too …

I will try to answer.
On the server side, you will install your couchbase server. The real database, that you can acess directly using a sdk.
On the server side too, you will install the sync gateway. This is the app that will acess directly to the server database.

On the mobile device, you will install a couchbase lite. You will have a local database which can live is life without any acess to the server.
If you want a synchronisation between the mobile database and the server, in your mobile application, you will start a connection to sync gateway, in 2 ways or one way, as you wish. This connection will do the job to synchronize your server and your mobile database.

I hope this is the answer you wanted.



Thank you. I managed to get to similar concluions. The only additional thing I had to do comparing to yor advice was to enable sharde buckets on Sync Gateaway by :slight_smile:
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”