logo
icon

CouchDB

An open-source, HTTP/JSON request-based document database that supports cross-platform synchronization.

template cover
Deployed5 times
Publisherlilixxs
Created2025-02-19
Services
service icon
Tags
Database

CouchDB Introduction

An open-source document-oriented, seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability

CouchDB is Simmilar to MongoDB, but more lightweight and easier to use.

Why CouchDB?

Apache CouchDB lets you access your data where you need it. The Couch Replication Protocol is implemented in a variety of projects and products that span every imaginable computing environment from globally distributed server-clusters, over mobile phones to web browsers.

Store your data safely, on your own servers, or with any leading cloud provider. Your web- and native applications love CouchDB, because it speaks JSON natively and supports binary data for all your data storage needs.

The Couch Replication Protocol lets your data flow seamlessly between server clusters to mobile phones and web browsers, enabling a compelling offline-first user-experience while maintaining high performance and strong reliability. CouchDB comes with a developer-friendly query language, and optionally MapReduce for simple, efficient, and comprehensive data retrieval.

Comparison of CouchDB and MongoDB

Similarities:

  1. Both are No-SQL document-oriented databases that can directly store, aggregate, transform, and return document-type (JSON) data.
  2. Both support highly available distributed cluster deployments.
  3. Both are open-source projects that can either be self-hosted or used with cloud service providers' offerings.

Main differences:

  1. CouchDB interacts via REST API, whereas MongoDB uses a database connection + its own query language.
  2. CouchDB focuses on availability (A) and partition tolerance (P), whereas MongoDB emphasizes consistency (C) and partition tolerance (P).
  3. CouchDB is an Apache project, and the official version does not offer commercial services; MongoDB provides commercial (MongoDB Enterprise) and cloud services (MongoDB Atlas).
  4. Current trend: MongoDB is more popular compared to CouchDB, and related support services are more robust.

Related Environment Variables

  • COUCHDB_USER: The initial admin username
  • COUCHDB_PASSWORD: The initial admin password

Service Usage Process

When the service is started for the first time, initialization is required. It is recommended to use the built-in Fauxton management panel for configuration.

  1. Access the built-in CouchDB browser management panel. The address is located in the Service Status page under CouchDB built-in Fauxton admin webpage. Log in with the initial username and password.
  2. Click the wrench icon on the left to begin initialization.
    1. Configure a Single Node = Configure as a single-node setup.
    2. Configure a Cluster = Configure as a cluster setup. You need to generate multiple CouchDB services in the project and modify port and password verification configurations. See the official documentation for details: https://docs.couchdb.org/en/stable/setup/cluster.html
  3. Once initialization is complete, you can start using it.

Managing the Database with the Integrated Fauxton Management Interface

Management interface documentation: https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide

Management panel address: Fauxton -- CouchDB built-in admin webpage in the Service Status page.

Log in with the username (CouchDB username) and password (CouchDB password).

The interface will allow you to manage database data and configurations.

Accessing the Database via REST API

API Documentation: https://docs.couchdb.org/en/stable/api/index.html

The following example shows how to send a GET request to the / path. The database should return a welcome message.

Use tools like curl to send HTTP REST requests.

curl <the address copied above>

The response will contain welcome data, including version features, version number, and more.

{
    "couchdb": "Welcome",
    "version": "3.4.2",
    "git_sha": "6e5ad2a5c",
    "uuid": "7687c62cfdf781f4623b721104a70c88",
    "features": [
        "access-ready",
        "partitioned",
        "pluggable-storage-engines",
        "reshard",
        "scheduler"
    ],
    "vendor": {
        "name": "The Apache Software Foundation"
    }
}