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 :

5970 questions
659
votes
7 answers

When to use CouchDB over MongoDB and vice versa

I am stuck between these two NoSQL databases. In my project I will be creating a database within a database. For example, I need a solution to create dynamic tables. So users can create tables with columns and rows. I think either MongoDB or…
Luke101
  • 56,845
  • 75
  • 204
  • 330
485
votes
19 answers

MongoDB or CouchDB - fit for production?

I was wondering if anyone can tell me if MongoDB or CouchDB are ready for a production environment. I'm now looking at these storage solutions (I'm favouring MongoDB at the moment), however these projects are quite young and so I foresee that I'm…
Alan
  • 12,874
  • 9
  • 40
  • 50
283
votes
3 answers

Difference between CouchDB and Couchbase

Are there any essential differences between CouchDB and Couchbase.
yojimbo87
  • 59,764
  • 22
  • 119
  • 130
198
votes
7 answers

Why should I use document based database instead of relational database?

Why should I use document based database like CouchDB instead of using relational database. Are there any typical kinds of applications or domains where the document based database is more suitable than the relational database?
Bartosz Blimke
  • 6,280
  • 3
  • 22
  • 19
154
votes
4 answers

NoSQL - MongoDB vs CouchDB

I am a complete noob when it comes to the NoSQL movement. I have heard lots about MongoDB and CouchDB. I know there are differences between the two. Which do you recommend learning as a first step into the NoSQL world?
mpenrow
  • 5,165
  • 9
  • 28
  • 35
147
votes
8 answers

When should I use a NoSQL database instead of a relational database? Is it okay to use both on the same site?

What are the advantages of using NoSQL databases? I've read a lot about them lately, but I'm still unsure why I would want to implement one, and under what circumstances I would want to use one.
smfoote
  • 5,018
  • 4
  • 27
  • 36
145
votes
9 answers

Use cases for NoSQL

NoSQL has been getting a lot of attention in our industry recently. I'm really interested in what peoples thoughts are on the best use-cases for its use over relational database storage. What should trigger a developer into thinking that particular…
robjmills
  • 17,839
  • 14
  • 71
  • 118
129
votes
3 answers

SQL (MySQL) vs NoSQL (CouchDB)

I am in the middle of designing a highly-scalable application which must store a lot of data. Just for example it will store lots about users and then things like a lot of their messages, comments etc. I have always used MySQL before but now I am…
christophmccann
  • 4,043
  • 7
  • 39
  • 63
123
votes
4 answers

Principles for Modeling CouchDB Documents

I have a question that I've been trying to answer for some time now but can't figure out: How do you design, or divide up, CouchDB documents? Take a Blog Post for example. The semi "relational" way to do it would be to create a few…
Lance Pollard
  • 66,757
  • 77
  • 237
  • 416
116
votes
11 answers

node.js database

I'm looking for a database to pair with a node.js app. I'm assuming a json/nosql db would be preferable to a relational DB [I can do without any json/sql impedance mismatch]. I'm considering: couchdb mongodb redis Anyone have any views / war…
Justin
  • 4,203
  • 5
  • 26
  • 54
103
votes
2 answers

Difference between Document-based and Key/Value-based databases?

I know there are three different, popular types of non-sql databases. Key/Value: Redis, Tokyo Cabinet, Memcached ColumnFamily: Cassandra, HBase Document: MongoDB, CouchDB I have read long blogs about it without understanding so much. I know…
never_had_a_name
  • 80,383
  • 96
  • 257
  • 374
81
votes
7 answers

Can I do transactions and locks in CouchDB?

I need to do transactions (begin, commit or rollback), locks (select for update). How can I do it in a document model db? Edit: The case is this: I want to run an auctions site. And I think how to direct purchase as well. In a direct purchase I…
user2427
  • 7,492
  • 18
  • 57
  • 71
79
votes
4 answers

CouchDB and Node.js - What module do you recommend?

What modules are you using to connect to your CouchDB server, in your Node.js applications? And why would you recommend whatever module you are using?
cllpse
  • 20,270
  • 35
  • 127
  • 168
77
votes
5 answers

Newtonsoft ignore attributes?

I am currently using the same C# DTOs to pull data out of CouchDB, via LoveSeat which I am going to return JSON via an ASP MVC controller. I am using the NewtonSoft library to seralise my DTOs before sending them down through the controller.…
Jammin
  • 2,960
  • 2
  • 21
  • 34
77
votes
6 answers

Pros/cons of document-based databases vs. relational databases

I've been trying to see if I can accomplish some requirements with a document based database, in this case CouchDB. Two generic requirements: CRUD of entities with some fields which have unique index on it ecommerce web app like eBay (better…
user2427
  • 7,492
  • 18
  • 57
  • 71
1
2 3
99 100