Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Database and collection limitations

Please help me to get below limits

What the limitation on maximum

database size,
collection size,
document size [ 16GB upper limit ]

With Latest MongoDB Version.

Hi @Nagarajan_Palaniappa,

For general information, please see MongoDB Limits and Thresholds in the MongoDB documentation. You’ll note that this doesn’t specifically mention a limitation on the number of databases or collections, but I’ll explain why below.

The maximum document size in MongoDB is currently 16MB, but if you are approaching that I would definitely give serious consideration to whether your data model can be improved. For some related commentary, see: Use case for storing pages of text like articles as key:value pairs.

The theoretical limits for maximum database and collection size are much higher than the practical limits imposed by filesystem, O/S, and system resources relative to workload. You can add server resources and tune for vertical scaling, but when your workload exceeds the resources of a single server or replica set you can also scale horizontally (partitioning data across multiple servers) using sharding.

Practical scaling involves more considerations than the size of data and is highly dependent on your workload, deployment topology, and resources. For example: the amount of data you need to actively work with relative to your total data stored, the volume of read/write operations, and expectations around performance metrics/SLA are all factors.

For some examples of deployments scaling across different dimensions, please see MongoDB at Scale. There are deployments with petabytes of data, billions of operations per day, and billions of documents. However, distributed deployments at that scale have significantly different resources than you may have getting started in a laptop or shared server environment.

I believe the theoretical limits are probably imposed by use of unsigned 64-bit integers (so perhaps 2^64 - 1 collections or databases), but the first soft limits you may encounter on most operating systems will be around available and open file handles (for example, ulimit Settings for Linux/UNIX-like environments). RAM, CPU, and I/O resources may also be limiting factors depending on your workload. The maximum size or number of files for a directory or filesystem will also vary depending on your filesystem options.

If you are managing your own server deployments, I strongly recommend reviewing the Operations Checklist, Production Notes, and Security Checklist relevant to your version of MongoDB and deployment topology.

Regards,
Stennie

4 Likes

Thankyou Stennie for the details… This helps…!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.