iOS CouchbaseLite changes rejected if >=20 local revisions between replications

I am noticing that if I pull replicate an existing document with a revision of “1-…”, then make more then 20 local revisions, incrementing its revision to “21-…” or greater, then push replicate, the replication succeeds, however the SG Database does NOT save the pushed revision. It still shows the document with revision “1-…” on the server.

I also notice that the CBL replication succeeds with no errors. It would make sense that this is related to the maxRevCount of 20, configured in CBLManager.

I tried db.compact() each time I save, as well as calling db.compact() before the push replicate. The document revisions are still ignored by Couchbase Server DB.


What version of CBL, on what platform? And what version of SG?
Also, how exactly did you verify that SG does not have revision 21?

CBL v1.4.1 - iOS
SG v1.5.1

I am looking at the document in Sync Gateway browser, in addition, I am pulling down that same document on a different mobile device, after attempting to push the document from the source device that has more than 20 revisions. The revision on the server still shows 1 on the server and the 2nd device.

This is interesting. So I was able to ensure changes are not rejected by the SG if I bump the database’s maxRevTreeDepth to higher number. It seems that as soon as the CBLDocument has been revised more then the maxRevTreeDepth, the document is rejected from the SyncGateway.

One thing to note is that I am not observing any conflicts in the CBLDatabase. I am wondering if I might see conflicts and get the opportunity to manage this in a fashion that the last revision wins, rather then the early revision? Going to test that out next.



Hi Andrew,

Did u got chance to resolve the usecase u mentioned