API Design Issue


#1

I am using PouchDB with Sync Gateway. I make an entry, the sync is happening in the background and time of the sync in unknown, therefore the api need to raise events when sync is complete. This is how firebase does it, but in firebase the developer has fine grained control over each entry with events. But this is not the case here?


#2

There are replication events that can be used to determine when all the documents that should be pushed have been pushed (for example changed, paused, active…). See all events here http://pouchdb.com/api.html#replication.

James


#3

As per documentation, “change” event in replication that was started with live mode acts as a completed sync cycle because if fetches all the yet synced documents.

http://pouchdb.com/api.html#replication-events


#4

Thanks for the reply James. I had already reviewed the reference you sent. The main issue is that the developers do not have control over which data is being replicated and in what sequence. What is required is that the developer has exact control on the data being asked for etc.


#5

So you’re looking for a way to know when a given document has been pushed to sync gateway?


#6

Yes something like that.


#7

I know there is a new method called pendingDocuments in 1.2 to know which documents haven’t been pushed yet. But I don’t know of an equivalent in PouchDB. Might be worthwhile to ping @nolanlawson on twitter.

James