Marko Anastasov wrote this on February 17, 2012

Beware of MongoDB's document size limit

Given I am MongoDB beginner
When designing a database for large quantities of data
Then I should be aware of the document size limit in BSON format

Including all embedded documents, MongoDB’s document size limit is currently 16 MB per document, unless you’re using GridFS (but it seems like if you can’t get GridFS from 3rd parties like MongoHQ or MongoLab?). Remember that MongoDB by default puts the working set of your database in RAM.

So if you expect to have millions of some things then you better put those things in a separate collection, even if semantically it may make more sense to embed them in another document. If you’re using mongoid that simply means having a stand-alone model referencing another model.

Useful discussions on Stack Overflow:

comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.


Rendered Text is a software company. For questions regarding Semaphore, please visit Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad