How to know which documents still need to be pushed

Hi all,

We need to find out what documents are pending from local couch-base lite to be pushed back ?

For this we are using pendingDocumentIDs but this always have all the documents Ids until we stop push replication and then it will clear up.

It may be a wrong observation but please let us know how to find out document pending to be pushed.

Thanks
Pankaj Sharma

You can use this in conjunction with isDocumentPending API to find out what’s pending

But ideally there should be a method to know how any documents are pending to be downloaded and uploaded.
This can help a lot in debugging.

Pankaj,

I haven’t tried these, but have you looked using getChangesCount, or getCompletedChangesCount?

This would be to find out the count. Your initial question asked about getting the remaining document IDs, but it sounds like you just want the count. Is that right?

there should be a method to know how any documents are pending to be downloaded and uploaded

For upload there is pendingDocumentIDs. If that’s not working for you, please give more details about the situation.

For download, there isn’t an efficient way to find that number. It would require first downloading the entire changes feed from the server and comparing each doc/rev ID against the local database. This happens during the course of replication, but in parallel with downloading the actual documents. And we throttle the rate at which we consume the changes feed, to limit memory usage; otherwise the replicator can end up consuming a lot of memory with bookkeeping.

Pankaj mentioned this in his original question

For this we are using pendingDocumentIDs but this always have all the documents Ids until we stop push replication and then it will clear up.

I know, but we’d need more information than that to really diagnose the problem.

I will keep you posted as soon as I will have the guy with me who was working on it.