Couchbase Server + Sync Gateway


I’ve see some posts about bucket shadowing but I noticed most people do not recommend it. The Bucket Shadowing wiki starts with a big Warning against its use.

That said, I’d like to know what is the recommended setup so I can have N1QL queries and the Sync Gateway at the same time.

I understand I can’t write to Sync Gateway bucket directly because of the CouchDB revision system, but could I use N1QL for querying the bucket while using the REST API for writing (updating, deleting, inserting)?

If this is not possible, is the bucket shadowing still the only/best way to allow this scenario (N1QL + Sync Gateway)?

Any other suggestion?


There shouldn’t be any problem using N1QL to query the bucket, as long as you’re not using any of N1QL’s write capabilities. The other caveat is that Sync Gateway adds an _sync property to each document it writes, to manage the metadata used by Sync Gateway for replication and security - you may need to account for this in your query design.