Challenge - 5 Problems
MongoDB Document Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:00remaining
What is the maximum size of a single MongoDB document?
MongoDB has a limit on how large a single document can be. What is the maximum size allowed for one document?
Attempts:
2 left
💡 Hint
Think about the BSON document size limit.
✗ Incorrect
MongoDB limits each document to a maximum size of 16 MB. This is to ensure efficient storage and retrieval.
❓ query_result
intermediate1:30remaining
What happens if you try to insert a document larger than the limit?
You try to insert a document with size 20 MB into a MongoDB collection. What will be the result?
Attempts:
2 left
💡 Hint
MongoDB enforces strict size limits on documents.
✗ Incorrect
MongoDB rejects documents larger than 16 MB and returns an error during insert.
📝 Syntax
advanced2:00remaining
Which document structure violates MongoDB rules?
Consider these four MongoDB documents. Which one violates MongoDB's document structure rules?
Attempts:
2 left
💡 Hint
Field names starting with $ are reserved in MongoDB.
✗ Incorrect
Field names in MongoDB documents cannot start with the dollar sign ($) as it is reserved for operators.
❓ optimization
advanced2:00remaining
How to store large files exceeding document size limit in MongoDB?
You need to store files larger than 16 MB in MongoDB. Which approach is correct?
Attempts:
2 left
💡 Hint
MongoDB provides a special specification for large files.
✗ Incorrect
GridFS is MongoDB's specification for storing and retrieving large files by splitting them into chunks.
🔧 Debug
expert2:30remaining
Why does this MongoDB insert fail with a 'BSONObjectTooLarge' error?
You run this insert command:
It fails with a 'BSONObjectTooLarge' error. Why?
db.collection.insertOne({ "data": new Array(17000000).fill(0) })It fails with a 'BSONObjectTooLarge' error. Why?
Attempts:
2 left
💡 Hint
Think about the size of the document created by the array.
✗ Incorrect
The array with 17 million zeros creates a document exceeding 16 MB, causing the BSONObjectTooLarge error.