When I do a push replication to the Sync Gateway from the phone it work like a charm but the problem occures when I try to do the opposite, when I try to do a pull replication to the phone it seems to do it but the database shows no documents when inspected via the cblite tools. Can anyone point me to a solution? Thank You!
Make sure your sync function is assigning docs to the the right channel and the user has access to that channel.
Hi! Thanks for the reply, I’m having issues understanding channels. I’m pretty sure my pull replication is not working because of the channels, I’ve read through the documentation and through posts online but can’t seem to understand how they function.
From the Sync function you can add any document to a channel using channel() then give the user access to that channel with access().
Here’s an example that assumes your document has the property “username” this assigns the document to the channel “channel.username” then gives the user username access to that channel.
var username = doc.username
channel(“channel.” + username);
access(username,“channel.” + username)
They have some good tutorials with full sample projects here: Developer Portal | Couchbase