0
votes

I am trying to sync pouchDB with couchBase through Sync Gateway, but i just get data added by pouchDB, not initial data added to couchBase. For example there is 750 docs in couchBase but none of them synced to the pouchDB. Also http://localhost:4985/_admin/db/db not showing couchBase docs too.

1
Informed our experts in mobile team. Somebody will reply. - Prasad Varakur
Thanks for your attention. - Meysam Izadmehr
What do you mean "initial data added to Couchbase"? How are you adding the data? - Hod
@Hod, data added to couchbase by using PHP SDK. After adding data to couchbase bucket, they are not shown in the sync gateway - Meysam Izadmehr

1 Answers

0
votes

The problem is with adding data to Couchbase Server directly. Couchbase Mobile currently requires extra metadata in order to deal with replication and conflict resolution. This isn't handled by the Server SDKs.

The recommended approach is to do all database writes through Sync Gateway.

To simplify use with PHP, you may want to use a Swagger PHP client. (You can see an example of using clients autogenerated by Swagger in this post. The example use Javascript and Node.js, but the principles are the same.)

You can read from Couchbase Server directly if you want (to do a N1QL query, for example).

Another option is to use "bucket shadowing". This is trickier, and is likely to get deprecated at some point. I only list it for completeness.