On Mar 19, 2016, at 3:35 PM, Brendan Duddridge <[email protected]<mailto:[email protected]>> wrote:
I would like to make an export routine to store a whole bunch of CBLDocuments in a single file. I would like to later import that file into the same or different database. Imagine a scenario where a user has a bunch of data they send to another person, that other person makes changes to the data, then sends it back. I know this can easily be accomplished by syncing, but there are other reasons for wanting to share data like this. The simplest way would be to create a JSON document consisting of an array of objects, one per document. You can write this really easily without scalability problems by just writing a “[“, then writing the docs one at a time with a “,” after each one but the last, then ending with a “]”. It’s not much harder to write and read the docs the way the replicator does — this would give you a sort of asynchronous replication where the recipient of the blob can import the docs into its db and the right thing happens if it already has earlier versions or the same versions of docs. On the master branch (i.e. 1.3) there’s a variant<https://github.com/couchbase/couchbase-lite-ios/issues/1118> of -[CLBDocument put:] that inserts an existing revision keeping its revID and history; you need that for the receiving side. For the sending side you have to add a property — I think it’s _revisions — that contains the rev history of the document. —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/094C194F-AF17-4169-98C6-EDC4936133FC%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
