Recall & Review
beginner
What is an ObjectId in MongoDB?
An ObjectId is a unique identifier automatically generated by MongoDB for each document. It ensures every document has a unique ID.
Click to reveal answer
beginner
How many bytes long is an ObjectId?
An ObjectId is 12 bytes long, combining different pieces of information to make it unique.
Click to reveal answer
intermediate
What are the parts that make up an ObjectId?
An ObjectId consists of: 4 bytes of timestamp, 5 bytes of random value (usually machine identifier and process id), and 3 bytes of an incrementing counter.
Click to reveal answer
beginner
Why does ObjectId include a timestamp?
The timestamp helps to know when the document was created and ensures part of the ID is unique over time.
Click to reveal answer
intermediate
Can ObjectId be manually created or changed?
Yes, you can create or assign your own ObjectId, but MongoDB generates it automatically if you don't provide one.
Click to reveal answer
How many bytes does a MongoDB ObjectId contain?
✗ Incorrect
An ObjectId is exactly 12 bytes long, combining timestamp, machine/process info, and a counter.
Which part of the ObjectId helps identify when the document was created?
✗ Incorrect
The first 4 bytes represent the timestamp of creation.
What ensures ObjectId uniqueness across different machines?
✗ Incorrect
The 5-byte random value includes machine and process identifiers to avoid collisions.
Can you assign your own ObjectId to a MongoDB document?
✗ Incorrect
You can manually create and assign ObjectIds if you want, but MongoDB generates them by default.
What is the purpose of the 3-byte counter in ObjectId?
✗ Incorrect
The 3-byte counter increments to avoid duplicates when many ObjectIds are created quickly.
Explain what an ObjectId is and describe its components.
Think about how MongoDB ensures each document has a unique ID.
You got /5 concepts.
Why does MongoDB include a timestamp in the ObjectId? How does this help?
Consider what information the timestamp gives about the document.
You got /3 concepts.