What is your preferred language for coding for the server side? (I expect to write some blogs on similar topics, so it would be good to know what languages people prefer.)
simple, always add and update the data using push command and it will maintain the revision for you. During fetching the data, pull the data with latestrevisionid() method and rest it will do for you.
Example -
@hod.greeley Pretty much all the server code is in C# – About a dozen (native windows) services, (ASP.NET) web apps and the reverse proxy run on IIS. The couchbase DBs & SGs run on ubuntu. All hosted on EC2.
@sidh007 Sorry but I’m not sure I understand the approach – in many cases picking the latest revision is not the desired way to resolve a conflict, e.g for documents that contain collections a merge is desirable.
As far as I understand it, although the SG gives you a ‘current’ revision, that revision may be in conflict. It’s up to the app to resolve it in a meaningful manner either server-side or client-side.
Also, you can have two revisions in conflict where a merge would make more sense (for the app) than simply picking a winning version. e.g. an app like ours where you can add meals to your day. Assume, two devices offline, add 2 meals on one device, 3 meals on the other device. When both devices go online & sync that may lead to a conflict. A reasonable resolution would be to merge the meals and end up with 5 (2 + 3) for that day.
@sidh007 this isn’t really accurate. Revisions and the revision tree aren’t there to avoid conflicts in a linear set of changes. They’re there so you can resolve conflicts between changes made by different sources.
Same example is given couchbase SG git account. In the example, we are resolving image attachment, change it accordingly to resolve conflicts of REV_ID