Couchbase Lite 2 Query on server documents

query

#1

Hi,

I have a simple question which I don’t seem to find it well clarified within the docs. When doing a query from android with Couchbase Lite 2.0, is the query done only against the local DB/documents? If yes, is there a way to do a query targeting the server db/SyncGateway?

The following is my usecase:

I have a big application that contains a lot of public data. It does not make sense to replicate all the (public) data to each user, because most of the documents may not be of interest for him. I plan on filtering the replication channels so that only relevant data is replicated. However the user should be able to query the server data which is not replicated but he has access rights on it.

Can you please give me a hint on what would be the best way to achieve this.

Thank you,
Cosmin


#2

Yes the queries are done locally only, as are all operations involving CRUD. Depending on your platform you might be able to leverage the Couchbase Server SDK though.

This part is going to cause problems. Access rights are controlled by Sync Gateway, but Sync Gateway has no query functionality. That functionality is up one level at Couchbase Server. You can send queries directly to the Couchbase Server bucket, but that is not built into the Couchbase Lite API and it won’t satisfy your second requirement without some more involved queries at least.