I’m working on an application that may require up to four conditions to be AND’ed together for client pull replications. But I don’t know if I can achive this using Sync Gateway, Couchbase Lite and Couchbase Server.
The Couchbase Server database may contain tens, or even hundreds, of “logical databases” that represent different customer sites. So the first condition would select one of these.
Then within each logical database, there may be up to three conditions that need to be AND’ed together to define the subset of documents to pull.
So as an example, a pull replication may have these conditions:
Site = ‘A’ AND Cond_1 = ‘B’ AND Cond_2 = ‘C’ AND Cond_3 = ‘D’
But I don’t know if I can achieve this with Sync Gateway as channels seem to be OR’ed together?
One possibility I thought of was to only use the first condition (Site = ‘A’) to pull the entire logical database, and then use filtering in the application for the other three conditions. Although this could work, it would result in a lot of unnecesaary documents being replicated from the logical database to the mobile device. And with up to several hundred logical databases, I assume each one would need a unique channel name - which would then have to be assigned to each user (unless I used roles instead)?
So is this a feasible use case for Sync Gateway?
Thanks,
Denis