Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Guide: Differences From CouchDB

jwalgran edited this page · 3 revisions

4. How TouchDB Differs From CouchDB

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

Native map/reduce/etc. functions. To make it as lightweight as possible, TouchDB 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.

No list or show functions, or rewrite handlers. These are mostly only useful for using CouchDB as a web-app server (CouchApps). TouchDB 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. TouchDB 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 TouchDB uses sqlite to store databases, the command-line sqlite3 tool can be useful if you know your way around SQL.

Embedded, not server. CouchDB is a server, running in a separate process and taking requests over TCP sockets. TouchDB 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 TouchDB to accept requests over a socket, but it's intended for P2P replication, not really for external clients.

NEXT: Adding TouchDB To Your App

Something went wrong with that request. Please try again.