I am using Couchbase server with Sync_gateway.
When I delete records from couchbase bucket using N1QL ‘delete’ query and the deleted records exists on mobile devices, then the deleted records gets added again to the couchbase bucket.
If I want to avoid it how can I achieve it.
I have also tried following in the mobile application,
Created a flag (With default value 0) for every documents I am uploading from mobile device.
While syncing the document we update the flag to 1.
I have set a filter to push replication, this filter restricts the documents for whome the value is 0.
With this logic any document needs to be uploaded to the cocuhbase bucket only once.
This approach works as long as the mobile application is running, if I restart the mobile application, all the synced documents existing on mobile device, and deleted from couchbase bucket, gets uploaded to the couchbase server.
When the app is restarted then is there any chance that the records are getting added to couchbase bucket (from mobile device) without push replication getting called ?
Is there any event from mobile side that I can handle in order not to allow these deleted records to the cocuhbase bucket again.