MongoDB performance with large documents

Hey @Baris_Karamanli

So for your questions:

  1. From the docs

Document Size Limit

The maximum BSON document size is 16 megabytes.

The maximum document size helps ensure that a single document cannot use excessive amount of RAM or, during transmission, excessive amount of bandwidth. To store documents larger than the maximum size, MongoDB provides the GridFS API. See mongofiles and the documentation for your driver for more information about GridFS.

So no 15mb is fine, but you are close to the limit.

  1. This depends on the memory amount for your cluster / system. You want to make sure that your working set and indexes “fit into” the amount of RAM you have. But since you said it is the same machine then you would need to deduct the amount of memory your application is using I think.

  2. Do you mean by having a large db? This can be solved by sharding with Mongodb, which will allow you to split a collection(s) across multiple replica sets in the cluster.

  3. You can use a TTL index on any collection where you would like mongo to expire the document. So Mongo has you covered there!

1 Like