One thing you can do is create your own mongoDB :-). Mongodb is open source and the document size limit is pretty arbitrary to provide a better layout design . You can simply change this line and create it for yourself. Be careful with that.
The most straightforward idea is to have each small question in another document with a field referencing its parent.
Another idea is to limit the number of documents in the parent . Suppose you are limited to N elements, then the parent looks like this:
{ _id : ObjectId(), id : { type: Number, required: true }, created: { type: Date, default: Date.now },
Thus, by modifying the number N, you can make sure that you will be in 16 MB BSON. And to read the entire survey, you can choose
db.coll.find({id: the Id you need}) , and then combine the entire survey at the application level. Also don't forget makeIndex on id .
Try different things, do a test on your data and see what works for you.
Salvador dali
source share