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

CouchDB best practices - all entities in a single db vs a new db for each entity?

I am starting with CouchDB. What is the accepted best practice to utilize databases? A single database per application storing all kinds of entities with smth like "_type" property to discriminate one from another or a separate database for each…
artemb
  • 9,251
  • 9
  • 48
  • 68
11
votes
2 answers

CouchDB read authorization

In couchdb website -> technical overview -> security and validation - http://couchdb.apache.org/docs/overview.html - it writes that (on reader access part) "To protect document contents, CouchDB documents can have a reader list. This is an…
mdikici
  • 1,374
  • 2
  • 13
  • 20
11
votes
1 answer

CouchDB conflict resolution

How does CouchDB handles conflicts while doing bi-directional replication? For example: Lets say there are two address book databases (in server A and B). There is a document for Jack which contains contact details of Jack. Server A and B are…
Sundar
  • 1,204
  • 1
  • 14
  • 17
11
votes
2 answers

Offline Firebase

I am implementing an AngularJS web app with Firebase as a backend; it should work offline, too; multi-user sync issues should be very limited, since the app - by design - will only allow new data entries when offline. I understand Firebase has…
MarcoS
  • 17,323
  • 24
  • 96
  • 174
11
votes
2 answers

CouchDB vs DesktopCouch

I've seen a couple of apps using something called the DesktopCouch. What are the differences between CouchDB and DesktopCouch?
josernestodavila
  • 387
  • 1
  • 5
  • 15
11
votes
4 answers

Which NoSQL db to use with C?

I'm working on an application that I'm going to write with C and i am considering to use a nosql db for storing timeseries data with at most 8 or 9 fields. But in every 5 minutes there will huge write operations such as 2-10 million rows and then…
systemsfault
  • 15,207
  • 12
  • 59
  • 66
11
votes
1 answer

How can I run the Couchdb test suite as mentioned in the Getting Started section of the tour?

This may be a very strange and/or dumb question, but I'm trying to follow along with the Couchd Documentation Getting Started section paragraph 1.4.2 describes running the test suite: Navigate to the test suite by clicking “Test Suite” on the…
Bas Bossink
  • 9,388
  • 4
  • 41
  • 53
11
votes
3 answers

couchdb query a view with key parameters

Without a key parameter, the view works correctly $curl…
pierrotlefou
  • 39,805
  • 37
  • 135
  • 175
11
votes
6 answers

couchDB , python and authentication

I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is: Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'} I hand edited the…
idiotype
  • 201
  • 3
  • 10
11
votes
2 answers

Reverse proxy to CouchDB hangs on POST and PUT in Node.js

I use request to implement the following reverse proxy to CouchDB in Express: app.all(/^\/db(.*)$/, function(req, res){ var db_url = "http://localhost:5984/db" + req.params[0]; req.pipe(request({ uri: db_url, method: req.method …
garbados
  • 885
  • 5
  • 21
11
votes
3 answers

Securing WIFI for a web application

I have created a CORS web application (only javascript), where I want to be installed and run under different LANs. I'd like to put SSL, but I don't know what the exact configuration of the lan will be and probably it will be different every time.…
JohnDel
  • 2,092
  • 8
  • 35
  • 64
11
votes
1 answer

Using multiple databases within the same application

I am currently developing an application in node.js. I have a Postgres/PostGIS database to store geospatial information and render them as SVG. That works fine so far. On the other side I have a CouchDB database filled with data, from a previous…
Mathias Vonende
  • 1,400
  • 1
  • 18
  • 28
11
votes
5 answers

What is couchdb, for what and how should I use it?

I hear a lot about couchdb, but after reading some documents about it, I still don't get why to use it and how. Could you clarify this mystery for me?
Natim
  • 17,274
  • 23
  • 92
  • 150
11
votes
3 answers

How to install and use couch db in android

How i should install and use couch Db in android. I mean local couch Db which i can use in tablet as well as emulator.What all steps i must follow to do so.
Amruta
  • 469
  • 2
  • 6
  • 16
11
votes
2 answers

CouchDB - Querying array key value for first key element only

I have a couchdb view set up using an array key value, in the format: [articleId, -timestamp] I want to query for all entries with the same article id. All timestamps are acceptable. Right now I am using a query like…
Gopherkhan
  • 4,317
  • 4
  • 32
  • 54