CouchDB is an open-source document-oriented NoSQL database that uses JSON to store data. It was created by Damien Katz in 2005 and became an Apache project in 2008. CouchDB stores documents in databases and provides a RESTful API for reading, adding, editing and deleting documents. It uses MVCC for concurrency and handles updates in a lockless and optimistic manner. CouchDB follows the CAP theorem and can be partitioned across multiple servers for availability. It uses MapReduce to index and query documents through JavaScript views. Replication allows synchronizing copies of databases by comparing changes. Data can also be migrated to mobile clients through integrations.
CouchDB Is..
• AnApache Project.
• An Open-Source Document-Oriented Database.
• it uses JSON to store data.
• Written in Erlang.
• CouchDB project was created in April 2005 by Damien Katz.
• CouchDB became an Apache Software Foundation project in 2008.
• In early 2012, Katz left the project to focus on Couchbase Server.
3
Document Storage
• ACouchDB server hosts named databases, which store documents.
• CouchDB provides a RESTful HTTP API for reading and updating (add, edit, delete) database documents.
• Document fields are uniquely named and contain values of varying types (text, number, boolean, lists, etc).
• The CouchDB document update model is lockless and optimistic.
• CouchDB read operations use a Multi-Version Concurrency Control (MVCC).
• The database never contains partially saved or edited documents.
• Document updates (add, edit, delete) are serialized, except for binary blobs which are written concurrently.
• Documents are indexed in B-trees by their name (DocID) and a Sequence ID.
5
6.
The CAP Theorem
•Consistency: All database clients see the same data, even with concurrent updates.
• Availability: All database clients are able to access some version of the data.
• Partition tolerance: The database can be split over multiple servers.
6
Introduction to Replication
•One of CouchDB’s strengths is the ability to synchronize two copies of the same database.
• CouchDB will compare the source and the destination database(Changes Feeds).
• Master - Master replication.
• Local documents are never replicated (non-replicating).
• The document will only be replicated if the filter function returns true.
11
12.
Migrating Data toClients
• Cloudant
• PouchDB
• TouchDB
• Couchbase Lite
12