Sync with Couchbase server (community version) not happening , whenever a json document is pushed to local client database, its not syncing with server.
Following is the code I am trying to execute when a document is inserted to local client db.
ProductId exists in my json doc which is pushed to client pouchdb
localpouchDB.replicate.to(remote couchBaseUrl + “mydb”, {
live: true,
filter: function (doc) {
return doc.productId== productId;
},
});
localpouchDB.replicate.from(remote couchBaseUrl + "mydb", {
live: true,
filter: function (doc) {
return doc.ProductId== productId;
},
});
Same code works on initial load of app when local client db is initialized.
Please help.
As mentioned, PouchDB is not a couchbase supported product so we cannot help you with issues within your PouchDB app. On Couchbase lite, you can set up replications to be in continuous mode (which is also default mode) so changes are automatically synced. Assuming live
mode in PouchDB is equivalent of that .
As next step, I would recommend that you look at the sync gateway logs and see if the docs are reaching sync gateway and if there is any errors reported by sync gateway (I"d suspect not since it works on initial startup) . Once thats confirmed, then you should follow up with the pouchDB team with the PouchDB logs.
Also, any reason you are not using Couchbase Lite?
From Network tab in Chrome, I can see call to Couchbase server always remains in pending state and never returns 204 response. Seems its not even reaching to Couchbase as its in pending state when replicate.to and replicate.from is called.
Sync only succeeds when I log out and log back in to my app/website.
So what do the sync gateway logs say? If nothing, then as indicated, this is something to follow up with the PouchDB team