Questions tagged [couchdb]

Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion. It exposes a pure restful API, making interaction possible from any language with the ability to send HTTP requests. This also allows "Futon", the administration interface, to work completely in the browser. It also offers incremental replication with bi-directional conflict detection and resolution.

(all below was copied directly from CouchDB's current wiki)

Introduction

Apache CouchDB is a scalable, fault-tolerant, and schema-free document-oriented database written in Erlang. It's used in large and small organizations for a variety of applications where a traditional SQL database isn't the best solution for the problem at hand. Among other features, it provides:

  • A RESTful HTTP/JSON API accessible from many programming libraries and tools
  • Futon, a browser based GUI and management tool
  • Incremental and flexible replication with conflict management
  • Incremental Map/Reduce queries written in any language (JavaScript support built-in)
  • Excellent data integrity/reliability
  • Native support for BLOBs (Binary Large Objects)
  • Easy installation on many platforms, from servers to mobile devices
  • A strong and active community
  • Good documentation in the form of Books, Presentations, Blog Posts, Wikis, and more

Because the data stored in CouchDB is a JSON document(s), the structure of the data, or document(s), can change dynamically. This feature greatly simplifies the maintenance and development of the database, especially over time when the data and its use evolve. Additionally, CouchDB doesn't rely on SQL JOINS to merge related data. This is often confusing for some users of traditional SQL databases, but is generally a non-issue once CouchDB users become familiar its powerful Map/Reduce framework.

One of CouchDB's most powerful features is its replication framework. This replication framework provides a comprehensive set of features:

  • Master → Slave replication
  • Master ↔ Master replication
  • Filtered Replication
  • Incremental replication with bi-directional conflict detection/resolution

These replication features can be used in combination to create powerful solutions to many problems in the IT industry, like reliability, and scalability. In addition to the fantastic replication features, CouchDB's reliability and scalability is further enhanced by being implemented in the Erlang programming language. Erlang has built-in support for concurrency, distribution, fault tolerance, and has been used for years to build reliable systems in the telecommunications industry. By design, the Erlang language and runtime are able to take advantage of newer hardware with multiple CPU cores. When you look at all of the great characteristics of Erlang, it becomes clear why CouchDB uses it for its foundation.

What it is Not

To better understand what CouchDB is, it may be helpful to understand a few things that CouchDB isn't.

  • A relational database. These differences are articulated above in the Meet CouchDB section, and other portions of this Wiki.
  • A replacement for all databases. When developing and designing a good information system you should select the best tool for the job. While CouchDB can be used in a wide variety of application types, including financial, you may find that a relational database, or other data store, is a better fit for your problem. If you are new to CouchDB, and aren't sure if it's a good fit for your data management problem, please ask others on the mailing list, and the #couchdb IRC channel for advice.
  • An object-oriented database. While CouchDB stores JSON objects, it isn't meant to function as a seamless persistence layer for an OO programming language.

Key Characteristics

Let's review some of the basic elements of CouchDB.

Documents

A CouchDB document is a JSON object that consists of named fields. Field values may be strings, numbers, dates, or even ordered lists and associative maps. An example of a document would be a blog post:

{
    "Subject": "I like Plankton"
    "Author": "Rusty"
    "PostedDate": "5/23/2006"
    "Tags": ["plankton", "baseball", "decisions"]
    "Body": "I decided today that I don't like baseball. I like plankton."
}

In the above example document, Subject is a field that contains a single string value "I like plankton". Tags is a field containing the list of values "plankton", "baseball", and "decisions".

A CouchDB database is a flat collection of these documents. Each document is identified by a unique ID.

Views

To address this problem of adding structure back to semi-structured data, CouchDB integrates a view model using JavaScript for description. Views are the method of aggregating and reporting on the documents in a database, and are built on-demand to aggregate, join and report on database documents. Views are built dynamically and don’t affect the underlying document; you can have as many different view representations of the same data as you like.

Schema-Free

Unlike SQL databases which are designed to store and report on highly structured, interrelated data, CouchDB is designed to store and report on large amounts of semi-structured, document oriented data. CouchDB greatly simplifies the development of document oriented applications, which make up the bulk of collaborative web applications.

In an SQL database, as needs evolve the schema and storage of the existing data must be updated. This often causes problems as new needs arise that simply weren't anticipated in the initial database designs, and makes distributed "upgrades" a problem for every host that needs to go through a schema update.

With CouchDB, no schema is enforced, so new document types with new meaning can be safely added alongside the old. The view engine, using JavaScript, is designed to easily handle new document types and disparate but similar documents.

Distributed

CouchDB is a peer based distributed database system. Any number of CouchDB hosts (servers and offline-clients) can have independent "replica copies" of the same database, where applications have full database interactivity (query, add, edit, delete). When back online or on a schedule, database changes are replicated bi-directionally.

CouchDB has built-in conflict detection and management and the replication process is incremental and fast, copying only documents and individual fields changed since the previous replication. Most applications require no special planning to take advantage of distributed updates and replication.

Unlike cumbersome attempts to bolt distributed features on top of the same legacy models and databases, it is the result of careful ground-up design, engineering and integration. The document, view, security and replication models, the special purpose query language, the efficient and robust disk layout are all carefully integrated for a reliable and efficient system.

Useful links


Books


Related tags :

6131 questions
3
votes
1 answer

Stream a couchdb attachment with web2py

I have some sound files in a couchdb database (not related to web2py). My web2py application has access to this database, and I want to stream the sound files so that they can be listened with the HTML audio tag, like this:
blueFast
  • 41,341
  • 63
  • 198
  • 344
3
votes
3 answers

How to use a custom couch.ini on Windows?

I am trying to work with some third-party code that does couchdb -a ./my/couch.ini This does not work on Windows because the couchdb.bat file does not pass arguments through to CouchDB. So CouchDB always starts up on the default port (5984),…
Domenic
  • 110,262
  • 41
  • 219
  • 271
3
votes
1 answer

haskell couchdb-conduit example

{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, ScopedTypeVariables #-} module Db ( couchTest ) where import Control.Monad.IO.Class (liftIO) import Data.ByteString (ByteString) import Data.Generics (Data, Typeable) import…
Gert Cuykens
  • 6,845
  • 13
  • 50
  • 84
3
votes
1 answer

A view in CouchDB to find recent forum threads with zero replies

Let's say we have the following data model for a hypothetical forum: // Post { "_id": 1, "type": "post", "text": "", "timestamp": 1, } // Reply { "_id": 2, "post_id": 1, "type": "reply", "text": "", "timestamp":…
Alex B
  • 82,554
  • 44
  • 203
  • 280
3
votes
2 answers

Is it possible to create a Couchbase view that groups output without a reduce function?

In Couchbase or CouchDB, is it possible to group without an explicit reduce function? In my client code, I want the data to be given to me just as a reduce would receive it (assuming all mappers were used as input, even during a rereduce). Using…
Jake Biesinger
  • 5,538
  • 2
  • 23
  • 25
3
votes
2 answers

What is the best database to track users relations?

I need to track users relations in a social app, something like this: UserA follow UserC, UserD, and UserE UserZ follow UserC, UserD, and UserE UserC follow UserA, UserD, and UserE And so on. First, I need a partition tolerant database so MySQL and…
Delta
  • 2,004
  • 3
  • 25
  • 33
3
votes
1 answer

BadYieldError in tornado.gen when using Corduroy couchdb async library

I'm trying to use Corduroy to talk to a CouchDB asynchronously using the python Tornado Web Server. The code below comes from the Corduroy guide, with a couple of alterations. import tornado.web from corduroy import Database, NotFound,…
colinjwebb
  • 4,362
  • 7
  • 31
  • 35
3
votes
2 answers

CouchDB - Variables in map function

I am quite new to CouchDB and have a very basic question: Is there any possibility to pass a variable from the client into the map function, e.g.: function (doc, params) { if (doc.property > params.property) emit(doc, null); } Thanks for your…
cschwarz
  • 1,195
  • 11
  • 24
3
votes
1 answer

Can I connect to CouchDB from ASP Classic / Javascript running on Windows?

Cloudant offers a hosted CouchDB, with a free starter level allowing 6GB of IO per month. Good for developers learning CouchDB. Since CouchDB allows specification of the map/reduce functions in Javascript, it might make sense to connect to it via…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
3
votes
1 answer

CouchDB document size limits

I'm tidying up the security in my app a little bit, and I have a quick question. I looked through my couchdb configuration and I noticed a maximum document size of 4294967296. Is that 4 MBs? And might you be able to put that in human terms, like a…
Costa Michailidis
  • 7,691
  • 15
  • 72
  • 124
3
votes
1 answer

How to do Bulk-insert from Huge JSON File (460 MB) in CouchDB

I need to do bulk-insert of document in my CouchDB database. I'm trying to follow the manual here: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API Here is my script: ~$ DB="http://localhost:5984/employees" ~$ curl -H…
3
votes
1 answer

couchdb POST method not supported in local instance

My local instance of couchdb seems not to support the POST method. This is the answer I have from chrome dev tools POST http://localhost:5984/epos-couch/_design/epos-couch/_view/ri 415 (Unsupported Media Type) the code in use is a simple ajax…
Daniele B
  • 3,117
  • 2
  • 23
  • 46
3
votes
1 answer

Can't connect with admin user after CouchDB fresh install on Ubuntu 12.04

I have a CouchDB installing issue on Ubuntu 12.04, actually is not an installing issue, but configuring. After installed with sudo apt-get couchdb I edit /etc/couchdb/local.ini and add adminuser = mypass to the [admin] section and then I try …
Eliseo Ocampos
  • 2,473
  • 4
  • 20
  • 32
3
votes
2 answers

how to access couchbase from couchdb REST API

i've learned couchdb for a year... i've tried bigcouch too... now i want to try couchbase, i've studied it 2 days, but i still don't know how to access couchbase from couchdb REST API (using NODEJS)... i've tried to searching on google how to…
yuda
  • 1,907
  • 3
  • 16
  • 23
3
votes
1 answer

How do you do atomic, multi-record, inter-dependent operations in NoSQL?

I'm originally familiar with relational-style data stores. I'm currently looking into NoSQL and trying to learn about its use-cases. Here's something that's been bugging me lately. How do you do the following operation using the typical NoSQL…
Ming
  • 1,613
  • 12
  • 27