Skip to content


Subversion checkout URL

You can clone with
Download ZIP


API to get number of unpushed local changes #224

snej opened this Issue · 1 comment

1 participant


It would be useful to be able to get the number of local documents in a database that haven't yet been pushed to the upstream server. This can be used to indicate to the user that the've got unsynced changes.

Len Kawell wrote:

This would be a great addition to the TouchDB API, even if it was only a "best guess." Since mobile devices have rather sporadic connectivity, slow upload speeds and people switch apps a lot, we're finding that our users don't notice that changes made on their devices haven't uploaded completely. It'd be nice to be able to show some kind of an indication showing that they still have some uploads pending, even if they aren't currently connected (we show the replication counts when the device is connected).


Until this is implemented, an app can this itself by tracking the local database’s _changes feed:

  1. When a push replication completes, ask for the database’s current sequence number. You can get this from the result of [database GET].
  2. Later on, fetch the _changes feed and tell it to start after the sequence number you’ve stored (i.e. GET /db/_changes?since=1234)
  3. The number of items in the “results” array property of the result is the number of documents that have changed since replication.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.