Set Documents sync Order in CouchBase Lite


Hi Folks,

1)DOC A is inserted to CBL.(Small doc).

2)DOC B is inserted to CBL.(Big doc).

DOC A is received.
DOC A is useless ,until the DOC B is reached the SW/Server and given access to it.

Is there a way to tell CBL to replicate DOC B first and then DOC A?

Only option at Receiver is to wait till the DOC B reaches SW/Server and then give access to DOC A?

How can we handle this use case?



Hi @nitz_couchbase,
I will try and figure out if you can set the sync order from CB Lite, but in the mean while… and I know this is not what your are asking, would it be possible to use Attachments?

From what I’m reading it could be that attachments could be a good solution here. Attachments allow you to a bigger chunks of data to a document (without the overhead of serialisation). One of the benefits of using attachments is that they are treated as part of the document and the document is not “synced” before the attachments are as well.

Here is a few more details about attachments,



Hi @martinesmann,

Well my use case is exactly the same, DOC B is the attachment document.DOC A is meta document of DOC B.

At Receiver ,DOC A has details of DOC B and we need to be given option to download the attachment only when its available at server.

What are the best ways to handle this use case in CBL or at SGW/CBserver.