Insert more than 16 MB document in Mongo db 3.0 using java

I rated Mongo db 3.0 in java and ran into a script when the document size exceeded 16 MB. The scenario is that I have a list of primary keys (unique entries) that should be in the document as an in-built collection with some additional fields. When pk exceeds 16k, we get an error indicating that the document size is exceeded. I know that we can store the collection outside the document instead of pasting it, but since it is required in our script, we have it this way. If we store it outside the document as a separate collection, it works fine, but inserts / updates become very slow, as it should look for all pk and insert / update.

Is there any other way we can do this?

I know that we can use gridfs for this, but since I saw examples, it is mainly used for storing images / videos, etc. in the file system. This, of course, is not how we want to do this.

Any suggestions would be very helpful !!! Thanks at Advance.

+6
source share
1 answer

Here is the official documentation:

MongoDB Limitations and Thresholds

They also suggest using GridFS when you exceed the BSON object size limit (16 megabytes). GridFS is used not only for media files, but also for all kinds of binary content.

+1
source

All Articles