5

There is a document with array, which size is more than 16 MB. How to store this document to be able to query some data from this array.

2
  • 1
    Just change your data model. A 16 MB document is too large and you should think that your design is incorrect. Commented Apr 29, 2016 at 11:35
  • 1
    You should be considering splitting your MongoDB document into multiple collections. Commented Apr 29, 2016 at 12:42

1 Answer 1

5

When you have documents which exceed the 16MB limit then you are very likely taking the denormalization approach of MongoDB too far and should consider to create another collection with one document for each array entry (or one document for each sensible grouping of array entries).

Another option is to treat the content as binary data and store it as a file in GridFS, but then you won't be able to do any meaningful queries on its content (only on the metadata you write for it separately).

The 16MB limit is hardcoded. You can not change it through configuration. There was a bugtracker ticket for that and it was closed as "Won't fix". But considering that MongoDB is open source, you could always change it in the sourcecode. Just keep the license conditions in mind when you do that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.