Storing attachments directly on Couchbase Server


Similar to below link to set attachment using CouchBase Lite,

I could not find any reference for storing attachments (Image/Audio) directly using Rest API’s on CouchBase Server which can be later synced to CouchBase Lite using Sync Gateway. Is it not possible?

Any comment(s)/suggestion(s) would be highly appreciated.

Hello, Couchbase Lite will only contact the Sync Gateway, it won’t contact Couchbase Server directly. So you have to go through the Sync Gateway all the time.
Or to say it differently, there is currently no REST API for attachement in Couchbase Server.


Thanks for your response.

I could figure out Sync Gateway Rest API’s (Public & Admin) for creating/reading attachments. However, no such Api to delete specific attachment. Deleting a document is fine. Is there an option to remove only attachment but not the parent document using Sync GW Rest API? Or do we need to edit the parent document (_attachments) & remove the attachment details so that attachment can no more be accessed?

Also, I understand that sync GW has a limit of 20 MB, so if I need to store more than 20 MB attachment, I will need to convert it into byte stream , chunk it & store in multiple documents as binary data. Will this work using sync Gateway Rest API,? I think Sync Gateway doesn’t support binary data. Or else, I will need to convert chunks of attachment, & then add multiple attachments to same document using Sync Gateway Rest API for multiple attachments.

Might want to ping @adamf for all the future enhancements on the Sync Gateway.