Couchbase sync - transactions, attachments and more


I am thinking about switching from sql based db to Couch mainly because it has built-in sync features. I have read the docs, but never found any detailed info how is sync done. In my current sync model, device switches to new content when all new data is successfully downloaded. It works like isolated transaction - remains invisible until all data (JSON) and resources (images, movies) are downloaded and then replaces current set.
Switching to Couch, I would like to have data with embedded resources to ease transfer process.
My concerns are:

  1. Is the couchbase infrastructure good for distributing content to multiple devices? How about binary attachments embedded into documents?
  2. Device should get only part of server data (subset). I believe it is possible using filters with Sync Gateway?
  3. Can I have “transaction” on whole data set, and then activate it in similar way I am doing now, or it has to be synced item-by-item?
  4. How to detect that data has been synced? Is it possible to send some signal to the app? Or maybe there is some flag that app has to read?

Hey @hubert,

Have you taken a look at the Sync Gate Guides over at the Mobile dev portal?

Regarding some of your questions…
1 Couchbase Mobile is a great solution to distribute content across multiple and different platforms. For Attachments, they are not part of the document’s JSON object but instead are uninterpreted data that is associated with a document.
2 There is a feature called, Channels, that would allow you to partition the data set accordingly so that your device can get part of the data set.
3 You can get the entire dataset
4 You may through the Replication class. Take it look at the Replication API and the ChangeDelegate method