MongoDB ObjectId Generator
Generate MongoDB ObjectIds with a timestamp, a random value and a counter, ready to use as _id values in test data.
How to generate an ObjectId
Choose how many
Set how many ObjectIds you want.
Generate
They appear straight away. Press the button for a fresh set.
Copy
Copy them for MongoDB documents.
When to use MongoDB ObjectId Generator
You are filling MongoDB test data and need realistic _id values.
A fixture or seed script needs 24-character hex IDs.
Tips for a better MongoDB ObjectId Generator result
Choose how many to generate and paste them into your documents.
Use the ID decoder to see the date inside one.
MongoDB ObjectId Generator: limits and what to check
An ObjectId is a 4-byte timestamp, 5 random bytes and a 3-byte counter, so IDs sort roughly by time, to the second.
Clashes across machines are very unlikely because of the random part and the counter.
About MongoDB ObjectId Generator
An ObjectId is the 12-byte default _id in MongoDB, shown as 24 hex characters: a 4-byte timestamp, 5 random bytes and a 3-byte counter. Use these to fill test data.
FAQs
Do they sort by time?
Roughly, to the second.
Are they unique across machines?
The random part and the counter make clashes very unlikely, as in real MongoDB drivers.
Can I see the date inside one?
Use Unique ID Decoder.