If Document A is inserted into the CouchbaseLite on a Mobile Device and the size is smaller than 20MB then the document will be synched to Couchbase Server via the Sync Gateway.
Now I have the following questions:
What if Document A is mutated on the Couchbase Server and the size is now greater than 20MB. Will the document get synched into the CouchbaseLite?
What if Document A is mutated on the Couchbase Server and the size is now greater than 20MB and then the document will be deleted. Will the delete get synched into the CouchbaseLite and purge the document although the size was greater than 20MB?
Both of these scenarios are not possible. The maximum document size in Couchbase Server is 20MB, so any server side writes (including Sync Gateway) will fail if the resulting document is over 20MB.
The maximum allowed document size is 20MB. This restriction applies to both Couchbase Server and Couchbase Lite. Here’s how it affects document synchronization:
Document Mutation Exceeding 20MB: If Document A is modified on Couchbase Server and its size exceeds 20MB, the mutation will not be allowed. Since Couchbase Server enforces a 20MB document size limit, any operation that would result in a document exceeding this limit, including updates or writes via Sync Gateway, will fail. As a result, the document cannot be synchronized to Couchbase Lite if the mutation exceeds the size limit.
Document Deletion Exceeding 20MB: If Document A is mutated on Couchbase Server to exceed 20MB and then subsequently deleted, the deletion will still be processed and synchronized to Couchbase Lite. The 20MB size limit applies to document creation and mutations but not to deletions. The deletion operation will succeed and will be lhi provider synchronized to Couchbase Lite, even if the document size before deletion was greater than 20MB.