Why developers choose CockroachDB over MongoDB

Consistent Transactions

Consistent Transactions

CockroachDB guarantees consistent and high performant ACID transactions at global scale and is never eventual

Development Ease

Development Ease

CockroachDB ensures data integrity, provides joins, and eliminates complex, error-prone application code

Business Workloads

Business Workloads

CockroachDB delivers a relational database built for operational workloads and more complex data models

CockroachDB and MongoDB are both used for scale-out applications; however, you should use CockroachDB for operational and transactional workloads.

Schema iconSchema
Document Model: JSON, partial SQL coverage through connectors
Relational Model and JSON, native SQL language
Data model complexity iconData model complexity
Optimized for non-relational data
Simple and complex, deep operational data models
Data integrity iconData integrity
Optional schema validation lacks referential integrity
Relational model enforces referential integrity and strict data types
Schema changes iconSchema changes
Agile with limited schema
Online, orchestrated schema changes
Availability iconAvailability
Raft protocol ensures availability during node failure
Raft protocol ensures availability during node failure
Resilience iconResilience
With Atlas, failed nodes restart.
Up-replicates data if nodes do not restart
Query routing iconQuery routing
Router processes act as gateways to the entirety of the database for unlimited reads and writes in any region
Every node is a gateway to the entirety of the database for unlimited reads and writes in any region
Transactional consistency iconTransactional consistency
Consistent transactions not guaranteed by default. Eventually consistent
Serializable, guaranteed consistent transactions
Transaction performance iconTransaction performance
Sub-optimal for transactional workloads
Optimized for transactional workloads
Multi-region writes iconMulti-region writes
Not by default, but possible with complex, careful setup
Native, all nodes can accept reads and writes even across regions
Data residency iconData residency
Tie data to a node to optimize performance or comply with data regulations
Tie data to a node to optimize performance or comply with data regulations
Developer tools iconDeveloper tools
Closed system with limited tooling, mostly created by vendor
Rich ecosystem of PostgreSQL developer tools
Multi-cloud iconMulti-cloud
Deploy in any environment
Deploy in any environment and even run a single instance across envs
Ideal workloads iconIdeal workloads
Simple hierarchical data models, access forward with minimal transactions (if any)
Optimized for relationship based, simple and complex transactional workloads

Relational (SQL) vs document model (NoSQL) databases

Relational databases are founded in relational algebra and deliver a highly efficient store that enforces data integrity in the database as opposed to in code.

Referential Integrity

With a relational database, maintaining parent/child, data types, and cardinality of relationships is enforced by the database.

With NoSQL, the developer needs to add complex code to the application to ensure data integrity and relationships.

Complex Joins

A relational database implements complex joins and aggregate views as part of its execution layer and offers simple DDL for making requests.

With NoSQL, joins are often the task of a developer who has to code these routines in their application logic.

Workloads

A relational database is optimal for workloads where data relationships are paramount such as transactional system of record workloads.

NoSQL is typically used when you have an established access pattern that will not evolve, with simple data models and minimal transactions (if any).

Switch to CockroachDB Today

/* Go hands-on with 100% free CockroachDB serverless. Spin up your first cluster in just a few clicks. */