Hi Jens, Run an all-docs query sorted by sequence starting just past the last > sequence you synced >
I know how to create an all-docs query, but how do I sort it by sequence number starting just past the last sequence synced? Is there a way I can query for the last sequence synced? And does the putExistingRevisionWithProperties function update that automatically? Or do I need to keep track of that separately in a local document in the database? I know that I can query by startKey but can I query on the last synced sequence to get all the changes in the database since I last synced? And for sorting by sequence number, do I set the sortDescriptors on the query? Doesn't that do the sorting in memory after querying the database? And can I sort by sequence number in that case? If you have some code example that shows me how to query all documents to get a list of changed documents since the last sync that would be super helpful. Thanks, Brendan On Monday, August 8, 2016 at 12:11:52 PM UTC-6, Jens Alfke wrote: > > > > On Aug 8, 2016, at 10:12 AM, Brendan Duddridge <[email protected] > <javascript:>> wrote: > > > > But many of my customers would prefer to use something like iCloud or > Dropbox for syncing. In fact, I just released the new version of my app > after a year in development switching over to Couchbase Lite and I've been > roasted in the app reviews because I dropped support for iCloud and Dropbox > syncing. > > You can never please all the users… > > > > > But I was wondering what the viability of using that method would be to > provide a file based sync solution? What I mean by that is I would take > incremental snapshots of the changes made since the last time a sync > operation occurred, then I would store the change file in iCloud Drive or > Dropbox and then on the other device, read the changes file and process it > using putExistingRevisionWithProperties. > > Yeah, building some kind of “change archive” like this wouldn’t be hard. > Run an all-docs query sorted by sequence starting just past the last > sequence you synced, then for each document write its current revisions' > JSON and all attachment bodies whose revpos is equal to the current > revisions’ generation. > > A Zip archive would be a convenient way to store this, where the internal > filename is either the docID or “docID/attachmentname”. > > But you’d have to write and upload a new snapshot every time you sync. A > device coming online has to read each snapshot that’s newer than the latest > one it’s read. So it’s not clear how you can ever delete old snapshots. > > —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/aa578a67-35e0-429f-9917-30ed0a7ad55e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
