Skip to content
Home › SQL Comparisons › ClickHouse vs MongoDB
Comparison · Database Engines

ClickHouse vs MongoDB

MongoDB is a document database for application data; ClickHouse is a columnar database for analytics. The usual question is not which one to run but whether analytics on your MongoDB data can stay in MongoDB (aggregation pipelines, Atlas analytics nodes) or should move to ClickHouse, which has had a production-ready JSON type since 25.3 and a MongoDB CDC ClickPipe in public beta on ClickHouse Cloud.

Last verified October 2026. Versions checked: ClickHouse 26.9, MongoDB 9.0. Licensing and features change; check the official sources for the latest details.

Quick verdict

Short answer

Keep MongoDB as the operational database for document data: it is built for reading and writing individual documents with indexes and transactions. Keep analytics in MongoDB while aggregation pipelines over your data run acceptably, ideally on Atlas analytics nodes so reports do not compete with the application. Add ClickHouse when dashboards and ad hoc analysis scan large volumes of documents, need SQL, or combine MongoDB data with other sources. On ClickHouse Cloud the MongoDB ClickPipe replicates collections into ClickHouse's JSON type, but it is still in public beta, so test it before relying on it.

How we know: This comparison is research-based: the status of ClickHouse's JSON type, the MongoDB ClickPipe (status, sources, requirements, billing) and the MongoDB table engine were checked against ClickHouse's documentation, changelog and blog, and MongoDB aggregation limits and Atlas analytics nodes against the MongoDB manual and Atlas documentation, in October 2026. We have not run benchmarks, so no performance figures are given.

ClickHouse is an open source, column-oriented database for analytics, under the Apache License 2.0, self-hosted or run as ClickHouse Cloud. The latest stable release line is 26.9. Its storage, key and update model are covered in ClickHouse vs PostgreSQL; this page is about analysing document data.

MongoDB is a document database storing BSON documents in collections, queried with the MongoDB Query API and aggregation pipelines, with replica sets, sharding and multi-document transactions. The current manual release is 9.0. Community Server is under the SSPL v1.0, and MongoDB, Inc. runs the Atlas cloud service.

Side by side

AspectClickHouseMongoDB
Designed for Analytical scans and aggregations over large, mostly append-only data Operational reads and writes of individual documents
Storage Columnar MergeTree tables; JSON paths stored as separate subcolumns BSON documents, one record per document, up to 16 MiB each
Semi-structured data JSON type, production ready since 25.3, with optional type hints per path Native; any document shape, with optional schema validation
Analytics language SQL Aggregation pipeline ($match, $group, $setWindowFields and more)
Memory limits on analytics Set by server and query settings 100 MB per stage before spilling to disk; from 9.0 also a per-operation limit
Isolating analytics A separate system by design Atlas analytics nodes (M10 and above) or secondary reads
Moving data between them MongoDB ClickPipe (CDC, public beta, ClickHouse Cloud); read-only MongoDB table engine and mongodb() table function Change streams feed external CDC pipelines
Licence Apache License 2.0 SSPL v1.0 (Community Server)
Main trade-off A second system and a pipeline, but SQL analytics at scale One system, but analytics shares resources and works document by document

Key differences

Analytics in MongoDB: the aggregation pipeline and its limits

The MongoDB manual describes an aggregation pipeline as one or more stages that process documents, each passing its output to the next. It handles filters, grouping, window functions and joins with $lookup, and $merge or $out can write results to a collection, which is a common way to maintain summary collections for dashboards.

// MongoDB (mongosh): revenue by country for shipped orders
db.orders.aggregate([
  { $match: { status: "shipped" } },
  { $group: { _id: "$customer.country", revenue: { $sum: "$total" }, orders: { $sum: 1 } } },
  { $sort: { revenue: -1 } },
  { $limit: 10 }
])

The limits are documented. A stage that needs more than 100 MB of memory either writes temporary files to disk or fails, depending on allowDiskUseByDefault and the per-command allowDiskUse option, and MongoDB 9.0 adds a per-operation memory limit (by default 1 GB or 20% of the memory available to the server process, whichever is greater). A pipeline is limited to 1000 stages. Heavy pipelines also run on the same replica set as your application, which is why Atlas offers analytics nodes: replica set members, available on dedicated M10 and larger clusters, that never become primary and are targeted with the nodeType:ANALYTICS read preference tag. In our view, that combination is enough for many operational dashboards and should be tried before adding a second database.

Documents in ClickHouse: the JSON type

ClickHouse's documentation states that the JSON data type was marked production ready in open source release 25.3 and is not recommended in production on earlier versions. It splits each document into subcolumns, one per path, up to max_dynamic_paths (1024 by default); further paths go into a shared structure that is less efficient to query. Paths without a type hint are read as Dynamic values and can be cast; paths you know in advance can be given a type, and unwanted paths skipped.

-- ClickHouse 26.9: orders as JSON, with type hints for paths you query often
CREATE TABLE orders_json (
    order_id String,
    doc      JSON(status String, total Decimal(12,2), customer.country String, SKIP internal)
) ENGINE = MergeTree
ORDER BY order_id;

SELECT doc.customer.country AS country, sum(doc.total) AS revenue, count() AS orders
FROM orders_json
WHERE doc.status = 'shipped'
GROUP BY country
ORDER BY revenue DESC
LIMIT 10;

-- a path without a type hint is Dynamic; cast it when reading
SELECT doc.channel::String AS channel, count() FROM orders_json GROUP BY channel;

Because each path is stored as its own compressed column, a query that touches three fields reads three columns rather than whole documents, which is the point of moving analytics to ClickHouse. The trade-off is that ClickHouse is not an operational document store: primary keys do not enforce uniqueness, updates are handled differently from MongoDB's in-place document updates, and documents arriving from MongoDB must be deduplicated by version, as described on our ClickHouse vs MySQL page for replicated rows.

Getting MongoDB data into ClickHouse

ClickHouse documents three routes, and they do different jobs:

  • MongoDB ClickPipe (ClickHouse Cloud only). ClickHouse's documentation states that ingesting from MongoDB via ClickPipes "is in public beta"; the Cloud changelog dates the promotion to public beta to January 2026. It performs an initial load and then continuous change data capture using MongoDB's Change Streams, which rely on the oplog. Supported sources are MongoDB Atlas, self-hosted MongoDB and Amazon DocumentDB, with MongoDB 5.1.0 or later; the beta announcement added sharded clusters, PrivateLink, SSH tunnelling and X.509 authentication. Documents are replicated into ClickHouse's JSON type by default.
  • MongoDB table engine and mongodb() table function. A read-only link to a remote collection, supported for MongoDB 7 and later. Simple WHERE, ORDER BY and LIMIT conditions are pushed down to MongoDB; nested documents and arrays arrive as JSON strings. Suitable for one-off loads and small lookups, not for keeping a copy in sync.
  • Your own pipeline for self-hosted ClickHouse: read MongoDB change streams with a CDC tool, often through a message queue, and write into ClickHouse tables that handle updates and deletes, for example with ReplacingMergeTree and a version column.

Because the ClickPipe is still a beta, check its documentation for current limitations, plan for resyncs, and make sure the oplog retains enough history for the pipe to catch up after an interruption.

Which fits which workload

MongoDB is the right home for the documents themselves: an order, a user profile, a product with variable attributes, read and updated by key or index with transactions where needed. ClickHouse is designed for the questions asked across millions or billions of those documents and the events around them: revenue by day and country, funnel analysis on clickstreams, percentiles over logs, joins with data from other systems.

A useful test is where the pain is. If application latency suffers when reports run, isolate them first (Atlas analytics nodes, secondaries, or $merge into summary collections). If reports themselves are too slow or too hard to express as pipelines, or analysts want SQL and BI tools, that is the case for ClickHouse. For a wider view of the database-versus-warehouse decision, see data warehouse vs database.

Pricing and licensing

ClickHouse open source is free under the Apache License 2.0. ClickHouse Cloud bills per compute unit-hour and per TB-month of storage, varying by plan, cloud and region. ClickHouse's CDC billing page states that MongoDB ClickPipes are free during public beta and that billing starts when the connector reaches general availability; the same page lists, for CDC ClickPipes, USD 0.10 per GB for initial load or resync and USD 0.20 per GB for continuous replication, plus CDC compute of USD 0.20 per hour on Scale and Enterprise (USD 0.10 on Basic).

MongoDB Community Server is free under the SSPL. MongoDB Atlas, listed on the MongoDB pricing page in October 2026 in USD: Free tier with 512 MB of storage; Flex at 0.011 per hour, capped at 30 per month; Dedicated clusters from 0.08 per hour (M10). Analytics nodes are available only on dedicated (M10 and larger) clusters, so isolating reports in Atlas means a Dedicated cluster; use the Atlas pricing calculator for the extra nodes.

Pricing checked on the vendors' official pages on 7 October 2026. Prices change; confirm before buying.

Where each one leads

ClickHouse strengths

  • Columnar storage reads only the JSON paths a query uses
  • JSON type production ready since 25.3, with type hints for frequently queried paths
  • SQL for analysts and BI tools, and joins with data from other sources
  • Managed MongoDB CDC through ClickPipes on ClickHouse Cloud, free during the beta
  • Apache 2.0 licence; self-hosted or managed

MongoDB strengths

  • One system for operational data and moderate analytics
  • Aggregation pipelines with $group, $lookup, window functions and $merge into summary collections
  • Atlas analytics nodes isolate reporting from application traffic
  • Built for document reads, updates and multi-document transactions

Limitations

ClickHouse limitations

  • Not an operational document store: no enforced uniqueness and a different update model
  • The MongoDB ClickPipe is in public beta and only on ClickHouse Cloud
  • The MongoDB table engine is read-only and requires MongoDB 7 or later
  • Paths beyond max_dynamic_paths are stored less efficiently

MongoDB limitations

  • Stages above 100 MB of memory must spill to disk or fail, and 9.0 adds a per-operation memory limit
  • Analytics competes with the application unless isolated
  • Analysts used to SQL must learn the aggregation pipeline
  • SSPL is not an OSI-approved licence

When to choose each

Choose ClickHouse if

  • Dashboards or ad hoc queries scan large volumes of documents or events
  • Analysts want SQL and standard BI tools
  • You need to combine MongoDB data with data from other databases or event streams
  • Reporting load is affecting the MongoDB cluster even after isolation

Choose MongoDB if

  • You need the operational store for document data
  • Analytics needs are moderate and pipelines run acceptably
  • You can isolate reports on Atlas analytics nodes or secondaries
  • You want to avoid running a second database and a CDC pipeline

When neither is right

Final recommendation

Bottom line

Use MongoDB for the documents and ClickHouse for analysis across them, and add ClickHouse only when MongoDB's own options run out. Aggregation pipelines, $merge summary collections and Atlas analytics nodes cover many operational reports. When scans grow large, analysts need SQL, or MongoDB data must be joined with other sources, ClickHouse's JSON type makes document data practical to analyse. On ClickHouse Cloud the MongoDB ClickPipe is the simplest feed, but it is a public beta in October 2026; self-hosted ClickHouse needs your own change-stream pipeline.

Frequently asked questions

Is ClickHouse's JSON type production ready?

Yes, from open source release 25.3, according to ClickHouse's documentation, which advises against using it in production on earlier versions. It stores each path as a subcolumn, up to max_dynamic_paths (1024 by default).

How do I replicate MongoDB to ClickHouse?

On ClickHouse Cloud, use the MongoDB ClickPipe, which does an initial load and then CDC through Change Streams from Atlas, self-hosted MongoDB 5.1 or later, or Amazon DocumentDB. It is in public beta and free until general availability. For self-hosted ClickHouse, use a change-stream CDC tool and model updates, for example with ReplacingMergeTree.

Can ClickHouse query MongoDB directly?

Yes, read-only. The MongoDB table engine and mongodb() table function read a remote collection (MongoDB 7 or later), pushing simple filters, ordering and limits to MongoDB. They suit one-off loads, not ongoing sync.

Can MongoDB handle analytics without ClickHouse?

Often. Aggregation pipelines cover grouping, window functions and joins, $merge can maintain summary collections, and Atlas analytics nodes isolate reporting. Memory limits per stage and, from 9.0, per operation, and the shared cluster, are what usually push teams to a columnar engine.

Can ClickHouse replace MongoDB?

Not as an operational document database. ClickHouse does not enforce unique keys and handles updates differently; it is designed for analytical reads over data that is mostly appended.

Sources

Checked October 2026.

How we research comparisons: our editorial method.

More comparisons

Browse all SQL comparisons or the tools directory.