Search code examples
iosswiftiphonecouchbase-lite

How to get list or id's of pending documents in Couchbase lite 2.1?


I am using Couchbase Lite 2.1 along with swift 4.1.

In previous versions, there was a method to get pending documents(documents to be synced).

But now in version 2.1, I don't how to get pending documents.


Solution

  • That API was removed in 2.0. There is a dicussion about that here

    The key takeaway is that as a workaround you can use replication eventing (a new feature in 2.5) to sort of keep track on your own. If you are concerned about specific documents being pushed you can add a listener and it will inform you on a document-by-document basis about which documents are pushed (or pulled).

    If all you care about is syncing everything that is in the database currently, then use a one-shot replication and wait for it to stop with no error. That will indicate that everything that was present in the DB when the replication started will be pushed.