Database / CouchDB Interview Questions
What is Couchbase Sync Gateway and how does it relate to CouchDB's replication model?
Couchbase Sync Gateway is the replication middleware layer in the Couchbase mobile stack. It sits between mobile clients running Couchbase Lite (the embedded mobile database) and a Couchbase Server cluster, handling authentication, authorization, and document routing. Historically it implemented a subset of the CouchDB replication protocol so that CouchDB-compatible clients could sync against it, but Couchbase has since moved toward its own DCP-based (Database Change Protocol) sync approach in newer versions.
The relationship to CouchDB's replication model:
- Early versions of Couchbase Sync Gateway exposed a CouchDB-compatible REST API and replication endpoint. This meant PouchDB could sync to Sync Gateway using exactly the same protocol it uses with CouchDB.
- Sync Gateway adds access control channels — each document is tagged with channels and each user is granted access to specific channels. This is a layer that CouchDB itself does not provide natively (CouchDB's access control is at the database level, not document level).
- From Couchbase Mobile 3.x onward, Couchbase Lite uses a proprietary BLIP WebSocket protocol (not the CouchDB HTTP replication protocol) for sync, diverging from CouchDB compatibility.
For CouchDB users, Sync Gateway is mainly relevant as a comparison point: if you need per-document access control with mobile sync, Sync Gateway's channel model is a more mature solution than CouchDB's validate_doc_update-based approach. Pure CouchDB users achieve similar results by combining PouchDB sync with per-user databases or filtered replication.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
