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
14
votes
1 answer

Should I connect directly to CouchDB's socket and pass HTTP requests or use node.js as a proxy?

First, here's my original question that spawned all of this. I'm using Appcelerator Titanium to develop an iPhone app (eventually Android too). I'm connecting to CouchDB's port directly by using Titanium's Titanium.Network.TCPSocket object. I…
k00k
  • 17,314
  • 13
  • 59
  • 86
14
votes
4 answers

MongoDB vs CouchDB (Speed optimization)

I made some tests of speed to compare MongoDB and CouchDB. Only inserts were while testing. I got MongoDB 15x faster than CouchDB. I know that it is because of sockets vs http. But, it is very interesting for me how can I optimize inserts in…
Edward83
  • 6,664
  • 14
  • 74
  • 102
14
votes
2 answers

How do I do the SQL equivalent of "DISTINCT" in CouchDB?

I have a bunch of MP3 metadata in CouchDB. I want to return every album that is in the MP3 metadata, but no duplicates. A typical document looks like this: { "_id": "005e16a055ba78589695c583fbcdf7e26064df98", "_rev":…
Blaine Lafreniere
  • 3,451
  • 6
  • 33
  • 55
14
votes
5 answers

I need an advice about NoSQL/MongoDb and data/models structure

Recently I'm exploring NoSQL Databases. I need an advice about how to store data in the most optimal and efficient way for a given problem. I'm targeting MongoDB, now. However it should be the same with CouchDB. Let's say we have these 3…
Stan Bright
  • 1,355
  • 1
  • 15
  • 22
14
votes
4 answers

CouchDB on Ubuntu 12.0.4 LTS: Stop and restart

I am in the process of evaluating CouchDB for a specific requirement and I am new to CouchDB. I have installed Couch DB using the package installation and it has started at the time of installation and listening to port 5984. Now i want to stop and…
Manikandan Kannan
  • 8,684
  • 15
  • 44
  • 65
14
votes
3 answers

How to get all npm packages that match a particular keyword in JSON format?

Not having any experience with couch and redis, this is becoming more than I can handle at this point. The npm website allows you to search for packages by a keyword - https://npmjs.org/browse/keyword/awesome However, it doen't provide any way of…
balupton
  • 47,113
  • 32
  • 131
  • 182
14
votes
2 answers

AJAX Call with Elasticsearch Search

I've been trying to figure out how to correctly request data from elasticsearch using a jQuery AJAX call. I either get an parsing error or I'll get every document in the index I'm searching under. $(document).ready(function() { var timer =…
neurosnap
  • 5,658
  • 4
  • 26
  • 30
14
votes
6 answers

Clean couchdb and restart

What is command to clean CouchDB please ? And if I want to disable and re-start my CouchDB what is command? Thanks
Mehdi
  • 2,160
  • 6
  • 36
  • 53
14
votes
3 answers

NoSQL Database for ECommerce

I will be constructing an ecommerce site, and would like to use a no-sql database, which will fit well with the plans for the app. But when it comes to which database would fit the job, im not sure. After comparing various DB's, the ones that seem…
skift
  • 1,027
  • 2
  • 16
  • 27
14
votes
1 answer

CouchDB vs MongoDB (memory utilization)

Which has the better performance in low memory environments (sub 1GB) ? I've used MongoDB in the past which seems to struggle memory-wise with a database of 250mb on a 512mb box, would the same be true of CouchDB ?
Imran
  • 581
  • 1
  • 6
  • 7
13
votes
2 answers

Why are reads from CouchDB so slow? (1.5MB/s or thereabouts)

I have a CouchDB (1.1.1) server running that contains a lot of documents in the 400-600KB size range. If I time fetching a full document from the database (not from a view, just the raw document) it takes 200-400ms to complete which equates to…
Jonathan Williamson
  • 1,189
  • 2
  • 10
  • 17
13
votes
1 answer

CouchApp user registration

I'm building a standalone couchdb application. These are called couchapps. The idea is that the database itself is served on port 80 and returns HTML and works as the actual website. This is a very powerful idea and I'm entirely amazed by this new…
Luca Matteis
  • 29,161
  • 19
  • 114
  • 169
13
votes
7 answers

import json file to couch db-

If I have a json file that looks something like this: {"name":"bob","hi":"hello"} {"name":"hello","hi":"bye"} Is there an option to import this into couchdb?
bobcom
13
votes
4 answers

Android + NoSQL

I am developing an app which is supposed to send data to a MySQL DB in a remote server so as to be later displayed in a webpage that grabs the data from that server, and I was wondering if it's possible to use some NoSQL solution instead of MySQL? I…
noloman
  • 11,411
  • 20
  • 82
  • 129
13
votes
1 answer

Can CouchDB handle 15 million records daily?

I'm relatively new to NoSQL databases and I have to evaluate different NoSQL-Solutions for a monitoring tool. The situation is the following: One datum is just about 100 Bytes big, but there are really a lot of them. During a day we get about 15…
andy
  • 1,852
  • 2
  • 20
  • 31