Skip to content

Guide: Differences From CouchDB

Chris Anderson edited this page Jul 30, 2013 · 6 revisions

9. How Couchbase Lite Differs From CouchDB

This section is only for those who are already familiar with Apache CouchDB and want to know what isn't the same.

Native map/reduce/etc. functions. To make it as lightweight as possible, Couchbase Lite doesn't come with a JavaScript interpreter. For this reason the functions that normally live as source code in a design document are instead implemented as native callbacks (blocks in Objective-C). Since they aren't stored in the database, they have to be registered at startup time. But on the plus side, they are really fast. (It is now possible to use JavaScript functions stored in design documents, if you're willing to link in some extra code. See the JavaScript Views documentation.)

No list or show functions, or rewrite handlers. These are mostly only useful for in a web-app server (CouchApps). Couchbase Lite is designed for apps with native UIs.

No multi-user features. There's no _users database or _security objects, since requests are coming directly from your app. Similarly, no login mechanisms like _session and _oauth. (The listener library does have an API to authenticate incoming requests, but it's currently very simplistic.)

No admin APIs. Couchbase Lite is missing several of the CouchDB REST APIs for server management, such as _config, _log, _restart, _stats.

No Futon. A Web-based UI to access your raw data seems inappropriate for an app (plus, there's no HTTP listener by default.) If you need to inspect a database during development, there is an unsupported [CouchDBViewer][VIEWER] app for that (it runs on Mac OS but you can use it on an iOS app's databases in the simulator); or since Couchbase Lite uses sqlite to store databases, the command-line sqlite3 tool can be useful if you know your way around SQL.

Embedded, not server. Apache CouchDB is a server, running in a separate process and taking requests over TCP sockets. Couchbase Lite is a library linked into an app, running as a thread and taking requests by inter-thread messaging. (It looks as though the requests go through HTTP connections, but that's a convenient fiction for compatibility; there are no sockets involved.) There is an add-on listener library you can use to enable Couchbase Lite to accept requests over a socket, but it's intended for P2P replication, not really for external clients.