Q7: What is the maximum document size limit in MongoDB, and how do you store larger files?

The maximum BSON document size limit is 16 Megabytes. This prevents individual documents from overloading RAM or network bandwidth during retrieval. To store files or documents exceeding 16MB, MongoDB provides GridFS, which splits files into 255KB chunks across two collections (fs.files and fs.chunks).

Key Takeaways
  • 16MB maximum single BSON document limit.
  • Use GridFS to automatically chunk and stream large files.
Knowledge Check

Which built-in MongoDB feature supports storing single files exceeding 16MB?