I am testing the Couchbase lite for a mobile app. So far, it works great. I have two questions about the Sync gateway:
We must have a Couchbase Server to store the documents to enable sync between devices, right? Other posts here talk about the Sync gateway only saving documents in memory. I want to confirm it is still true in Sync Gateway 3.0.
I don’t want to store the documents on the server forever, but we need the server to sync documents across devices. So, Is there such a feature to tell Couchbase to auto-purge the document when it knows the document already synced to all devices(active Couchbase lite clients?)
Couchbase Server is required when using Sync Gateway, correct. Couchbase Mobile also supports peer-to-peer replication between devices.
In general documents should to be retained on the server for as long as they are active on clients, unless you’re working in a peer-to-peer only deployment. Sync Gateway isn’t aware of the full set of client devices (and in addition whether any of those devices may have had their databases rebuilt by something like an application uninstall/reinstall), so it’s not possible to determine when the document is no longer ‘needed’ for client replication.
My use case is, users want the sync feature (through our server), but they do not want to store the document forever. From what you mentioned, this may be the only solution I can think of for now:
Track the information about how many active devices a user has. let’s say three devices, A, B, and C. (for active, we can think of it used within a month or year).
Find the information about document synced information (I am wondering how to get it from Couchbase Server?).
Remove the document from the Couchbase server if it synced to all active devices (A, B, and C).
So, my question is about step 2, can we get the synced information from Couchbase Server API or do we have to track devices and synced information on the devices by ourselves in the backend. Thanks.