Couchbase Lite bi-directional sync is not working as expected

I’ve resolved it, but gotta say, it was incredible hard just to make sync gateway work

Found the answer here:

I have modified my sync function like so:

function (doc, oldDoc, meta) {
  channel('user');
  // this one was actually needed, so for anyone who wants to work with sync gateway we have to actually dig a bit deeper :(
  access('my-user', 'user');
}