Introduction to Apache CouchDB

Apache CouchDB was developed by Apache Software Foundation and initially released in 2005. CouchDB is written in Erlang. It is an open-source database that uses various different formats and protocols to store, transfer, and process its data. It uses JSON to store data, JavaScript as its query language using MapReduce, and HTTP for an API. Documents are the primary unit of data in CouchDB and they also include metadata. Document fields are uniquely named and contain values of varying types and there is no set limit to text size or element count.

History

CouchDB was written in the Erlang programming language. It was started by Damien Katz in 2005. CouchDB became an Apache project in 2008. The current version of CouchDB is 1.61.

Architecture
 

CouchDB Architecture

The architecture of CouchDB is described below: 

  1. CouchDB Engine: It is based on B-tree and in it, data is accessed by keys or key ranges which map directly to the underlying B-tree operations. It is the core of the system which manages to store internal data, documents, and views.
  2. HTTP Request: It is used to create indices and extract data from documents. It is written in JavaScript that allows creating Adhoc views that are made of MapReduce jobs.
  3. Document: It stores a large amount of data.
  4. Replica Database: It is used for replicating data to a local or remote database and synchronizing design documents.

Features of CouchDB

Features of CouchDB includes the following:



  1. Replication: It provides the simplest form of replication and no other database is so simple to replicate.
  2. Document Storage: It is a NoSQL database that follows document storage where each field is uniquely named and contains values of various data types such as text, number, Boolean, lists, etc.
  3. ACID Properties: The CouchDB file layout follows all the features of ACID properties.
  4. Security: It also provides database-level security and the permissions are divided into readers and admins where readers can do both the read and write to the database.
  5. Map/Reduce: The main reason for the popularity of CouchDB is a map/reduce system.
  6. Authentication: CouchDB facilitates you to keep authentication open via a session cookie-like a web application.
  7. Built for Offline: CouchDB can replicate to devices like smartphones that have a feature to go offline and handle data sync for you when the device is back online.
  8. Eventual Consistency: CouchDB guarantees eventual consistency to provide both availability and partition tolerance.
  9. HTTP API: All items have a unique URI(Unique Resource Identifier) that gets exposed via HTTP. It uses the HTTP methods like POST, GET, PUT, and DELETE for the four basic CRUD (Create, Read, Update, Delete) operations on all resources.

Advantages of CouchDB

Advantages of CouchDB includes the following:

  1. HTTP API is used for easy Communication.
  2. It is used to store any type of data.
  3. ReduceMap allows optimizing the combining of data.
  4. Structure of CouchDB is very simple
  5. Fast indexing and retrieval.

Disadvantages of CouchDB

Disadvantages of CouchDB includes the following:

  1. CouchDB takes a large space for overhead, which is a major disadvantage as compared to other databases.
  2. Arbitrary queries are expensive.
  3. There’s a bit of extra space overhead with CouchDB compared to most alternatives.
  4. Temporary views on huge datasets are very slow.
  5. It doesn’t support transactions
  6. Replication of large databases may fail.
     

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.