Details
-
Task
-
Resolution: Won't Fix
-
Major
-
None
-
None
Description
From https://github.com/couchbase/sync_gateway/issues/3518#issuecomment-386279116
*AFAIK Couchbase/Sync Gateway don't have any documentation regarding writing a replicator. Thus, it's very difficult to write one.
I made a lot of effort to combine CouchDB documentation and own findings to write a working replicator in JS (browser-compatible JS).
By working, I mean one that doesn't contain bugs. It's very easy to make one in the replication protocol.In terms of conflict resolution the only article that has some meaningful code and notes is this one:
https://developer.couchbase.com/documentation/mobile/current/guides/sync-gateway/resolving-conflicts/index.html
In terms of quality of code in the article, ehm... it's disputable. I had hard time understanding how to resolve a conflict and how to create it.
Why is the article hard to comprehend?
follows JS anti-patterns such as well-known callback-hell
It's one, huge wall of text instead of step by step instruction with examples
It's missing critical information (I guess the code will work when you deploy it in testing env but it's definitely not production ready)
the missing bit, which is also missing in the SGW/CBS documentation, is poorly documented _revisions parameter which is crucial when creating/updaing documents (that was my problem)
I think there are more issues but I have finally got the code working so I did not focus on proofreading