I’m new to Couchbase & NoSQL in general.
I’m trying to get to the position where we have our documents about our facilities stored in Couchbase Server, so that our existing CMS can push the relevant data into the couchbase server. They can then be made available to a xamarin forms mobile app via couchbase sync gateway. This will allow us to add additional information as needed. With a little bit of work I managed to get the documents from the Couchbase Server replicated into the gateway with the config settings of
,"enable_shared_bucket_access": true
,"import_docs": "continuous"
That worked great, we can make our changes to the documents in CB server and the documents arrive on the devices like magic and are available offline. So far so good.
Now I need to attach images to go with those documents, but I’m getting stuck. There is no way (that I could find) in the Server SDK to create attachments on documents.
My next approach was to try and store the documents as plain blobs by just passing the bytes of the image into a _bucket.Upsert call. That created the documents, but none of those documents seem to appear on the sync gateway. I’m not sure if this is because there are no channels in the document, or if it is something else.
My next approach was to try to create the documents via the Sync Gateway Rest API and then create attachments for them. Creating the documents worked OK, but the attachments refused to create with a response of {“error”:“Forbidden”,“reason”:“forbidden”}.
On a side note: If I try to PUT a document that already exists I keep getting a response of {“error”:“conflict”,“reason”:“Document exists”}, which strikes me as odd given that I understand a PUT to mean “Create or update document” from the documentation
Hope I have not over-loaded the question
Sync gateway 1.5
Couchbase server 5.0.1 Community edition