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
27
votes
6 answers

CouchDB dump to file and load from file

I cannot replicate between two couchdb servers, so I would like to dump to file from one server and load from file into the other server. I used this statement to dump and it worked fine: curl -X GET…
eriq
  • 1,524
  • 3
  • 13
  • 22
26
votes
2 answers

inheritance in document database?

I am wondering because I searched the pdf "[noSql] the definitive guide" and "beginning [noSql]" for the word "inheritance" but I didn't find anything? am I missing something? because I'm doing a tablePerHierarchy inheritance with hibernate and…
nils petersohn
  • 2,317
  • 2
  • 25
  • 27
26
votes
4 answers

How can I delete multiple documents in CouchDB?

I want to delete all documents where foo equals x. Seems like a pretty basic operation, but I just can't figure it out. I know how to delete an individual document, but that's not good enough - I may have to delete a few thousand at a time. How do I…
Mike Baranczak
  • 8,291
  • 8
  • 47
  • 71
25
votes
6 answers

How to map clojure code to and from JSON?

I have a crazy idea, which involves putting some clojure code into CouchDB and writing views that query it. I don't want to store the clojure code as plain text, because then I would have to worry about parsing it in the views. Formatting and…
Benjamin Atkin
  • 14,071
  • 7
  • 61
  • 60
25
votes
2 answers

What are the best uses of document stores?

I have been hearing a lot about document oriented data stores like CouchDB. I understand the uses of BigTable like stores such as Cassandra. After reading this question, I was wondering what the conditions would be to merit using a document store?
Mantas Vidutis
  • 16,376
  • 20
  • 76
  • 92
25
votes
3 answers

Curl giving "Invalid UTF-8 JSON" error from CouchDb although JSON is fine? Any ideas?

This is slightly different from the question titled "Error about ‘invalid JSON’ with couchDB view but the json’s fine": I am not trying to upload a file only enter a simple document. The example I am trying to use is actually from O'Reilly's book…
Alfamale
  • 1,069
  • 1
  • 9
  • 13
24
votes
1 answer

couchdb search or filtering on key array

I have this in my view function: emit([doc.address.country,doc.address.state, doc.address.city], doc); When I query the search, I need to have all 3 elements of the array filled in, for example: ?key=["US","NY","New York"] that will produce my…
Matt
  • 1,811
  • 1
  • 19
  • 30
24
votes
10 answers

Full-text search in NoSQL databases

Has anyone here have any experience deploying a real online system that had a full text search in any of the NoSQL databases? For example, how does the full-text search compare in MongoDB, Riak and CouchDB? Some of the metric that I am looking…
unj2
  • 52,135
  • 87
  • 247
  • 375
23
votes
8 answers

Can I use MongoDB as a replacement for CoreData on iOS?

I'm just starting to read up on NoSQL technologies such as MongoDB and CouchDB. I'm interested in knowing whether I can use MongoDB or indeed any NoSQL technology as a replacement for Core Data applications. Core data applications can take a long…
zardon
  • 2,910
  • 6
  • 37
  • 58
23
votes
2 answers

bigtable vs cassandra vs simpledb vs dynamo vs couchdb vs hypertable vs riak vs hbase, what do they have in common?

Sorry if this question is somewhat subjective. I am new to 'could store', 'distributed store' or some concepts like this. I really wonder what do they have in common and want to get an overview on all of them. What do I need to prepare if I want to…
Mickey Shine
  • 12,187
  • 25
  • 96
  • 148
23
votes
4 answers

CouchDB versioning strategy

Would the following be a viable strategy for implementing versioning(using "example" as a sample document type): Have one original document where the type field is named example_original. Subsequent changes to the document all have type…
mac
  • 9,885
  • 4
  • 36
  • 51
23
votes
4 answers

CouchDB on Windows?

I started exploring CouchDB and I am interested in following: Is there or will there be a Windows install? If there is, is there a shared hosting provider that offers CouchDB? Not knowing much about it, can it be somehow embedded in my application…
epitka
  • 17,275
  • 20
  • 88
  • 141
23
votes
1 answer

CouchDB-wide read-only access rights

I need to create a CouchDB user which can only read documents from any database but can't write any of them. As far as I'm concerned, it is not what is supported by default (user types are described here). As the wiki says, access rights are given…
Sergey Savenko
  • 666
  • 6
  • 11
22
votes
8 answers

What is the difference between CouchDB and Lotus Notes?

I was looking into the possibility of using CouchDB. I heard that it was similar to Lotus Notes which everyone loves to hate. Is this true?
fooledbyprimes
  • 999
  • 1
  • 11
  • 29
22
votes
2 answers

What is the CouchDB equivalent of the SQL COUNT(*) aggregate function?

Yep, I'm a SQL jockey (sorta) coming into the CouchDb Map/Reduce world. I thought I had figured out how the equivalent of the COUNT(*) SQL aggregator function for CouchDB datasets with the following: Map: function(doc) { emit(doc.name,…
Brad Gessler
  • 2,744
  • 4
  • 23
  • 22