couchdb
Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
Top Related Projects
The MongoDB Database
The open-source database for the realtime web.
:kangaroo: - PouchDB is a pocket-sized database.
OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
Quick Overview
Apache CouchDB is a distributed, open-source NoSQL database that uses JSON for documents, JavaScript for MapReduce queries, and HTTP for an API. It's designed for reliability and scalability, offering features like multi-version concurrency control and real-time change notifications.
Pros
- Easy to use and intuitive HTTP/JSON API
- Built-in multi-master replication for excellent scalability
- ACID semantics with eventual consistency
- Flexible document schema allows for easy adaptation to changing data structures
Cons
- Performance can be slower compared to some other NoSQL databases
- Limited support for complex queries and joins
- Requires careful design to avoid conflicts in multi-master setups
- Learning curve for MapReduce views can be steep for newcomers
Getting Started
To get started with CouchDB, follow these steps:
- Install CouchDB from the official website or using a package manager.
- Start the CouchDB server.
- Access the web interface at
http://localhost:5984/_utils/
. - Create a new database using the web interface or via curl:
curl -X PUT http://localhost:5984/mydb
- Insert a document:
curl -X POST http://localhost:5984/mydb -H "Content-Type: application/json" -d '{"name": "John Doe", "age": 30}'
- Retrieve the document:
curl http://localhost:5984/mydb/_all_docs?include_docs=true
For more advanced usage, refer to the official CouchDB documentation.
Competitor Comparisons
The MongoDB Database
Pros of MongoDB
- Better performance for large-scale applications with high write loads
- More flexible schema design, allowing for easier data model changes
- Stronger support for horizontal scaling and sharding out of the box
Cons of MongoDB
- Less mature ACID transaction support compared to CouchDB
- Potentially higher storage requirements due to document-based structure
- More complex configuration and management for advanced features
Code Comparison
MongoDB query example:
db.collection.find({ status: "active" })
.sort({ createdAt: -1 })
.limit(10)
CouchDB query example:
db.find({
selector: { status: "active" },
sort: [{ createdAt: "desc" }],
limit: 10
})
Both databases use JSON-like query syntax, but MongoDB's query language is generally considered more intuitive and powerful for complex operations. CouchDB relies more heavily on MapReduce for advanced querying, which can be more challenging to work with for some developers.
MongoDB excels in scenarios requiring high write throughput and flexible schemas, while CouchDB offers better built-in multi-master replication and a more straightforward approach to eventual consistency. The choice between the two often depends on specific project requirements and scalability needs.
The open-source database for the realtime web.
Pros of RethinkDB
- Real-time push architecture for live updates
- Flexible query language with support for JavaScript
- Built-in administration interface for easy management
Cons of RethinkDB
- Smaller community and ecosystem compared to CouchDB
- Less mature and battle-tested in production environments
- Limited support for mobile and edge computing scenarios
Code Comparison
RethinkDB query example:
r.table('users')
.filter(r.row('age').gt(18))
.orderBy('name')
.limit(10)
.run(conn, callback)
CouchDB query example:
db.find({
selector: {
age: { $gt: 18 }
},
sort: [{ name: 'asc' }],
limit: 10
})
Both databases offer JSON-based document storage and support for complex queries. RethinkDB's query language is more expressive and allows for chaining operations, while CouchDB uses a more declarative approach with Mango queries.
RethinkDB excels in real-time applications and offers a more intuitive query language, but CouchDB has a larger ecosystem, better support for offline-first applications, and a more established presence in production environments.
:kangaroo: - PouchDB is a pocket-sized database.
Pros of PouchDB
- Runs in the browser, enabling offline-first web applications
- Lightweight and easy to set up for small to medium-sized projects
- Synchronizes data seamlessly between browser and server
Cons of PouchDB
- Limited scalability for large-scale applications compared to CouchDB
- Fewer advanced features and configuration options
- Potentially slower performance for complex queries on large datasets
Code Comparison
PouchDB (JavaScript):
const db = new PouchDB('mydb');
db.put({
_id: 'mydoc',
title: 'Hello PouchDB'
}).then(function (response) {
// Handle response
}).catch(function (err) {
console.log(err);
});
CouchDB (HTTP API):
PUT /mydb/mydoc HTTP/1.1
Host: localhost:5984
Content-Type: application/json
{
"title": "Hello CouchDB"
}
Both PouchDB and CouchDB use similar JSON document structures and RESTful APIs, but PouchDB provides a more JavaScript-friendly interface for browser-based applications. CouchDB, being a full-fledged server database, offers more robust features for server-side operations and scaling.
OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
Pros of OrientDB
- Multi-model database supporting graph, document, key/value, and object models
- Native support for graph operations and traversals
- Better scalability with distributed architecture and sharding capabilities
Cons of OrientDB
- Smaller community and ecosystem compared to CouchDB
- Steeper learning curve due to its multi-model nature
- Less mature replication and conflict resolution mechanisms
Code Comparison
OrientDB (SQL-like query language):
SELECT FROM Person
WHERE name = 'John'
AND age > 30
CouchDB (Mango query):
{
"selector": {
"name": "John",
"age": {"$gt": 30}
}
}
Both databases offer JSON document storage, but OrientDB provides more flexibility with its multi-model approach. CouchDB excels in ease of use and has a more mature replication system. OrientDB's graph capabilities make it suitable for complex relationship-based data, while CouchDB's simplicity and HTTP API make it ideal for web applications. The choice between them depends on specific project requirements and the desired data model complexity.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Apache CouchDB README
+---------+ | |1| |2| | +---------+
.. |1| image:: https://ci-couchdb.apache.org/job/jenkins-cm1/job/FullPlatformMatrix/job/main/badge/icon?subject=main :target: https://ci-couchdb.apache.org/blue/organizations/jenkins/jenkins-cm1%2FFullPlatformMatrix/activity?branch=main .. |2| image:: https://readthedocs.org/projects/couchdb/badge/?version=latest :target: https://docs.couchdb.org/en/latest/?badge=latest
Installation
For a high-level guide to Unix-like systems, inc. Mac OS X and Ubuntu, see:
INSTALL.Unix
For a high-level guide to Microsoft Windows, see:
INSTALL.Windows
Follow the proper instructions to get CouchDB installed on your system.
If you're having problems, skip to the next section.
Documentation
We have documentation:
https://docs.couchdb.org/
It includes a changelog:
https://docs.couchdb.org/en/latest/whatsnew/
For troubleshooting or cryptic error messages, see:
https://docs.couchdb.org/en/latest/install/troubleshooting.html
For general help, see:
https://couchdb.apache.org/#mailing-list
We also have an IRC channel:
https://web.libera.chat/#couchdb
The mailing lists provide a wealth of support and knowledge for you to tap into. Feel free to drop by with your questions or discussion. See the official CouchDB website for more information about our community resources.
Verifying your Installation
Run a basic test suite for CouchDB by browsing here:
http://127.0.0.1:5984/_utils/#verifyinstall
Getting started with developing
Quickstart:
.. image:: https://img.shields.io/static/v1?label=Remote%20-%20Containers&message=Open&color=blue&logo=visualstudiocode :target: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb
If you already have VS Code and Docker installed, you can click the badge above or
here <https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/apache/couchdb>
_
to get started. Clicking these links will cause VS Code to automatically install the
Remote - Containers extension if needed, clone the source code into a container volume,
and spin up a dev container for use.
This devcontainer
will automatically run ./configure && make
the first time it is created.
While this may take some extra time to spin up, this tradeoff means you will be able to
run things like ./dev/run
, ./dev/run --admin=admin:admin
, ./dev/run --with-admin-party-please
,
and make check
straight away. Subsequent startups should be quick.
Manual Dev Setup:
For more detail, read the README-DEV.rst file in this directory.
Basically you just have to install the needed dependencies which are
documented in the install docs and then run ./configure && make
.
You don't need to run make install
after compiling, just use
./dev/run
to spin up three nodes. You can add haproxy as a caching
layer in front of this cluster by running ./dev/run --with-haproxy --haproxy=/path/to/haproxy
. You will now have a local cluster
listening on port 5984.
For Fauxton developers fixing the admin-party does not work via the button in
Fauxton. To fix the admin party you have to run ./dev/run
with the admin
flag, e.g. ./dev/run --admin=username:password
. If you want to have an
admin-party, just omit the flag.
Contributing to CouchDB
You can learn more about our contributing process here:
https://github.com/apache/couchdb/blob/main/CONTRIBUTING.md
Cryptographic Software Notice
This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See https://www.wassenaar.org/ for more information.
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.
The following provides more details on the included cryptographic software:
CouchDB includes a HTTP client (ibrowse) with SSL functionality.
Top Related Projects
The MongoDB Database
The open-source database for the realtime web.
:kangaroo: - PouchDB is a pocket-sized database.
OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot