What Is MongoDB?
MongoDB is a source-available document database developed by MongoDB, Inc. that stores data in flexible, JSON-like documents encoded in a binary format called BSON (Binary JSON). Every document stored in a standard collection requires a unique, immutable _id field that acts as a primary key; if you omit it on insertion, the client driver generates an ObjectId automatically.
When engineering teams ask what is MongoDB or evaluate mongodb vs postgresql for a new service, the architectural distinction starts with how records are stored on disk and licensed in production. MongoDB, Inc. (Nasdaq: MDB) licenses all versions of MongoDB Community Server and tools released after October 16, 2018 under the Server Side Public License (SSPL) v1.0.
Under the SSPL, your organization can use, review, modify, and redistribute the software for free, unless you provide MongoDB as a publicly available service, which requires either open-sourcing your management software or buying a commercial license. Official client drivers remain under the Apache License v2.0, while commercial server licenses come through MongoDB Enterprise Advanced subscriptions.
You can run the database in three main deployment editions. MongoDB Community Edition is the free, source-available server for Linux, Windows, and macOS. MongoDB Enterprise Advanced is the subscription-based, self-managed server that adds LDAP, Kerberos, on-disk encryption, and auditing. For teams preferring managed infrastructure, MongoDB Atlas runs as a fully managed multi-cloud DBaaS across AWS, Microsoft Azure, and Google Cloud; current Atlas tiers and prices are in the FAQ below.
If your code reads and writes an entire business object together, storing that hierarchy in a single BSON document eliminates multi-table join overhead and lets your schema evolve alongside your domain models.
As of October 2026, the current stable release series of the database server is the 9.0-series, following 8.3, 8.0, and 7.0. Its query memory limit and the new Queryable Encryption queries are listed in the table below; full release specifications and API guides are in the official MongoDB documentation.
How MongoDB Works
MongoDB operates through a distributed architecture powered by the WiredTiger storage engine, organizing BSON documents into collections across replica sets for high availability and sharded clusters for horizontal write scaling.
Under the hood, the WiredTiger storage engine keeps your most recently used data and indexes in RAM so that read queries are served directly from memory, although the engine does not cache query results to return identical responses. To keep memory and network operations predictable, the engine enforces strict operational boundaries that you should verify in the MongoDB limits and thresholds manual before finalizing your data model.
Two operational limits catch teams off guard. MongoDB does not allow unique indexes across shards unless the unique index contains the full shard key as a prefix, and cluster performance drops with too many collections and indexes (Atlas recommends at most 5,000 on M10 and 10,000 on M20/M30 as of October 2026). Server sessions with no activity for 30 minutes expire and close their cursors, even with noCursorTimeout(), unless the worker calls refreshSessions.
| Component or limit | Role and threshold (as of October 2026) |
|---|---|
mongod | The primary database server daemon that manages data storage, background threads, and WiredTiger memory. |
mongos | The query router for sharded clusters that directs client reads and writes to the appropriate shard. |
mongot | The dedicated process that powers MongoDB Search and Vector Search workloads. |
mongosh and Compass | mongosh is the JavaScript shell for administration and querying; MongoDB Compass is the free, source-available GUI licensed under the SSPL. |
| BSON document limits | Maximum document size is 16 mebibytes (MiB) with a maximum nesting depth of 100 levels; files exceeding 16 MiB require the GridFS API. |
| Index and sort limits | A collection supports up to 64 indexes, a compound index holds up to 32 fields, and a query can sort on up to 32 keys. |
| Replica set topology | A replica set supports up to 50 total members, with a maximum of 7 voting members for primary elections. |
| Aggregation pipelines | Up to 1,000 stages per pipeline; each stage has a 100 MB RAM limit before spilling to disk when allowDiskUseByDefault is enabled (true by default since v6.0). |
| Query memory | Since the 9.0 series, a per-operation ceiling of 1 GB or 20% of server process memory, whichever is greater, across all memory-tracked stages. |
| Transactions and writes | Multi-document ACID transactions have a 60-second default lifetime (transactionLifetimeLimitSeconds); one write command accepts up to 100,000 writes. |
| Queryable Encryption | Equality and range queries on encrypted fields are GA; Server 9.0 adds prefix, suffix, and substring queries (libmongocrypt 1.20.0 or later). |
| Atlas connections | Concurrent connections per node by tier: 500 on Free and Flex, 1,500 on M10, 3,000 on M20/M30, 6,000 on M40, up to 128,000 on M200/M300. |
We recommend MongoDB when your application domain maps naturally to self-contained aggregates, polymorphic records, or high-volume write streams that will outgrow a single write node. The classic production mistake is a monotonically increasing shard key such as the default _id ObjectId: every new insert lands on one shard, and the cluster becomes a single-node write bottleneck. We choose a hashed shard key or a high-cardinality business key from day one.
Document database (BSON)
SSPL v1.0 server, Apache 2.0 drivers
Community, Enterprise Advanced, Atlas
Polymorphic data, high write volume, vector search
Years in business
Senior engineers
Projects delivered
What MongoDB Is Used For
MongoDB is used for workloads where schema flexibility, nested object storage, high-throughput ingestion, or integrated vector and full-text search outweigh strict relational normalization.
AI, Agents, and Semantic Search
Teams building AI and agentic workloads keep application state, conversation histories, and vector embeddings in one collection. The dedicated mongot process runs vector and full-text search without syncing records to a separate vector database.
Time Series and Stream Processing
IoT platforms, financial tickers, and telemetry systems use time series collections with columnar compression, native gap-filling queries, and stream processing. Ingestion pipelines can batch up to 100,000 writes in a single write command.
Payments and Regulated Data
Financial and healthcare applications rely on multi-document ACID transactions and field-level cryptography. Client-Side Field Level Encryption or Queryable Encryption protects sensitive fields before data leaves the application.
Location-Aware Apps and Gaming
Gaming studios and logistics platforms store player profiles, dynamic inventories, and location coordinates, and use built-in geospatial queries to match nearby entities in real time.
MongoDB vs PostgreSQL and MySQL
When evaluating mongodb vs postgresql and mongodb vs mysql, the core trade-off is native document modeling with built-in sharding versus relational schemas with SQL joins and vertical write scaling.
| Criterion | |||
|---|---|---|---|
| Primary data model & schema | Stores polymorphic BSON documents (up to 16 MiB and 100 nested levels) in collections without requiring a predefined schema; supports optional schema validation. | Relational DBMS that stores data in predefined tables of rows and columns; supports semi-structured data via the binary jsonb column type. | Open-source RDBMS developed by Oracle Corporation that enforces rigid table schemas and referential integrity across normalized tables. |
| JSON & document indexing | Natively indexes any BSON document field or nested array, allowing up to 64 indexes per collection and 32 fields per compound index. | Decomposes JSON into binary jsonb storage alongside relational columns and supports GIN, B-tree, and hash indexing. | Supports a JSON column type with JSON functions and schema validation, but indexes JSON only through generated columns in engines like MySQL NDB Cluster. |
| Query language & joins | Queried via the MongoDB Query API; embeds related data in single documents or executes cross-collection joins via $lookup and $graphLookup aggregation stages. | Queried via standard SQL with native multi-table relational joins. | Queried via SQL with native joins across normalized tables. |
| ACID transactions | Supports multi-document, multi-statement ACID transactions with snapshot isolation across replica sets and sharded clusters, with a 60-second default runtime limit. | Supports multi-statement ACID transactions with snapshot isolation. | Enforces relational ACID integrity across normalized table schemas. |
| Write & read scaling | Built-in horizontal scale-out for writes and reads via native sharding (mongos) and distributed transactions across replica sets. | Relies primarily on vertical scale-up for writes and full-copy replicas for read scaling. | Traditional relational architecture centered on normalized tables rather than native document sharding. |
| License model | Community Server (post-October 16, 2018) is licensed under SSPL v1.0; client drivers use Apache 2.0; commercial licenses via Enterprise Advanced. | Open-source relational database management system. | Open-source RDBMS developed by Oracle Corporation. |
When to Choose MongoDB
Choose MongoDB when your data is hierarchical or polymorphic and changes structure often, or when write throughput needs horizontal sharding across nodes. Up to 64 indexes per collection on any nested field mean you do not split domain objects across tables just to query them. It also fits roadmaps that combine operational CRUD with vector, full-text, or time series workloads in one engine.
When MongoDB Is Not the Right Fit
Choose a relational database when your model depends on strict normalization, foreign-key integrity, and complex ad-hoc SQL joins across many tables; heavy $lookup patterns erase the advantages of the document model. If your team prefers SQL and needs only occasional semi-structured fields, PostgreSQL with jsonb and GIN indexes is simpler. The SSPL also rules MongoDB out for a publicly offered database service without a commercial license.
How We Approach MongoDB Projects
We design MongoDB systems around real query patterns, with schema validation, deliberate index design, and an explicit shard key strategy from day one.
Access-Driven Schema and Indexes
Schema flexibility does not mean ignoring structure. We enforce required fields with schema validation, keep polymorphic subdocuments flexible, and budget indexes: at most 64 per collection, 32 fields per compound index, and well under the Atlas ceiling for collections and indexes.
Shard Keys and Connection Pools
We test candidate shard keys for even chunk distribution and use hashed or non-monotonic keys instead of the default ObjectId. Unique indexes include the full shard key, and connection pools are sized against Atlas tier caps such as 1,500 connections on M10.
Defense-in-Depth Security
Clusters run in trusted networks with strict firewall rules and centralized authentication logs. On Enterprise Advanced we enable LDAP, Kerberos, auditing, and on-disk encryption; sensitive fields use Client-Side Field Level or Queryable Encryption with strict log access.
Sound like the right partner?
Frequently Asked Questions
Direct answers to the most common architectural, licensing, and operational questions teams ask when evaluating MongoDB.
Is MongoDB free for commercial use under the SSPL?
Yes, organizations can use, review, modify, and redistribute MongoDB Community Server for free in commercial applications under the Server Side Public License (SSPL) v1.0, which applies to all releases after October 16, 2018. The restriction applies only if you offer MongoDB itself as a publicly available service; doing so requires open-sourcing all management software used to run that service or purchasing a commercial license. Official MongoDB client drivers are licensed separately under the permissive Apache License v2.0.
Does MongoDB support ACID transactions and joins?
Yes, MongoDB supports multi-document, multi-statement ACID transactions with snapshot isolation across both replica sets and sharded clusters. As of October 2026, multi-document transactions have a default runtime lifetime limit (transactionLifetimeLimitSeconds) of 60 seconds. For queries that need to combine data across collections rather than reading embedded documents, MongoDB performs joins using the $lookup and $graphLookup aggregation pipeline stages.
What is the maximum document size limit in MongoDB?
As of October 2026, the maximum BSON document size in MongoDB is 16 mebibytes (MiB), and documents can have a maximum nesting depth of 100 levels. If your application needs to store binary files or payloads larger than 16 MiB, MongoDB provides the GridFS API to chunk and store those files across collections.
Can PostgreSQL JSONB replace MongoDB?
PostgreSQL’s binary jsonb data type can replace MongoDB when your application is primarily relational and only needs to store and index semi-structured documents alongside standard rows and columns using GIN, B-tree, or hash indexes. However, jsonb does not replace MongoDB when you need native horizontal write scaling via built-in sharding and distributed transactions across replica sets, as PostgreSQL relies primarily on vertical scale-up for writes. MongoDB also treats every record natively as a BSON document with support for up to 64 indexes per collection across any nested field or array.
How much does MongoDB Atlas cost per month?
As of October 2026, MongoDB Atlas Core offers a Free forever tier ($0/hour for 512 MB storage), a Flex tier ($0.011/hour capped at $30/month for 5 GB storage), and a Dedicated tier starting at $0.08/hour ($56.94/month) with 10 GB to 4 TB of storage, 2 GB to 768 GB RAM, and 2 to 96 vCPUs. For high-scale workloads, Atlas Infinite (in public preview on M10+ clusters as of October 2026) starts at $0.09/hour ($65/month) and decouples compute and storage up to 128 TB per shard. You can check current regional rates on the official MongoDB pricing page.