Best way to inject data in bucket when using sync gateway

Hi.
I recently start using Couchbase for a new project.
I need to inject data into my couchbase server bucket and then sync these datas to android devices via sync gateway.
My question is: Am I obliged to use sync gateway restfull api to load data into my bucket or is there an other way?

If you are using SG 1.5 above with XATTR enabled, you can load your data into bucket via Couchabse SDK directly and then sync these datas to android devices via sync gateway…
FYI

1 Like

To elaborate on Atom’s point, if you are using SGW 1.5, here is an example of the SGW config setting `enable-shared_bucket_access"

Also, set import_docs to continuous.

Thanks for your replies.

Do keep in mind that only one sync-gateway in the cluster should import documents (import_docs=true).

1 Like

Yes, indeed. Good reminder.

As mentioned in this blog post on Shared bucket access …

Deployment Note: In a non-accel SG deployment, only a single SG node should have import_docs=continuous to avoid duplicate processing of documents

I have a couple of question about this argument:

  1. Can I update documents from SDK too and get them synced to mobile or is it only possible to add them?
  2. in a scenario with 2 sync gateways, I have to set “enable_shared_bucket_access”:true in both and “import_docs”: “continuous” only n one of them, is it correct?

Thanks
Paolo

Yes. You can update and they will be synced

  1. in a scenario with 2 sync gateways, I have to set “enable_shared_bucket_access”:true in both and “import_docs”: “continuous” only n one of them, is it correct?

yes

1 Like