When sync gateway is running, if saving a document directly to Couchbase via the web dashboard, the OnUpdate() function is firing twice.
Documents saved through sync gateway results in OnUpdate() firing once.
When I kill sync gateway, saving documents to Couchbase results in OnUpdate() firing once.
Does Exist a workaround for this problem?
If you have enable_shared_bucket_access turned on to have Sync Gateway import SDK writes, the 2 OnUpdate events are expected.
The first being your original SDK write, and the second being Sync Gateway importing that document, stamping necessary metadata, and writing that back to the Couchbase Bucket.
There is a workaround noted here to ignore Sync Gateway updates: https://issues.couchbase.com/browse/MB-29360?focusedCommentId=318277&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-318277