Sync Gateway API - Count of changes

Using the _changes endpoint, there is an option to not return the body of all the documents, but you still get a list of all the document ids which can grow to be very very large in memory on a mobile device. Is there a way to only get the count of documents instead of a list of all the documents and then calling .size() on the array?

While replicating, the total value coming out of couchbase lite is constantly changing (ie, synced 200/400, synced 250/500, synced 300/600 etc…) so this is not a reliable way of getting the count either; although it would be the easiest

To anyone following along at home: as a workaround, I’ve decided to just accept the response as a string instead of doing any deserialization into an object, and just counting the instances of “{“seq”:”

I think you could also do this with a View running on Sync Gateway. Register a map function that counts all documents and updates, or if you just want docs filter out the ones that have an old doc when the map function is called. You might want also to decrement your count when a deleted doc gets processed.

Views and Queries on Sync Gateway are only available through the admin api, though: