Should I use the allowDiskUse parameter when the returned document exceeds the 16 MB limit in aggregation?
Or do I need to change the database structure or the logic of the codes in order to avoid the limitation? What are the advantages and disadvantages of "allowDiskUse"? Thank you for your help.
Here is the white paper I saw: Result size limits
Changed in version 2.6.
Starting with MongoDB 2.6, the aggregate command can return a cursor or save the results in a collection. When you return the cursor or save the results in the collection, each document in the result set depends on the size limit of the BSON document, currently 16 megabytes; if any one document exceeds the BSON document size limit, the command will generate an error. The limit applies only to returned documents; documents can exceed this size during pipeline processing.
Memory Limitations¶
Changed in version 2.6.
100 . , MongoDB . , allowDiskUse, .
https://docs.mongodb.com/manual/core/aggregation-pipeline-limits/