ObjectId options
12-byte IDs: timestamp, random, counter.
Everything runs locally. Nothing is sent to any server.
Generate MongoDB-style ObjectIds: 24-character hex IDs built from a Unix timestamp, random bytes and an incrementing counter. Perfect for seed data, test fixtures and prototyping document databases.
12-byte IDs: timestamp, random, counter.
Everything runs locally. Nothing is sent to any server.
A MongoDB ObjectId is 12 bytes shown as 24 hex characters: a 4-byte Unix timestamp, a 5-byte random value unique per process, and a 3-byte incrementing counter. The timestamp leads, so ObjectIds sort roughly by creation time, and the counter guarantees uniqueness when many IDs are minted in the same second.
ObjectIds shine as distributed-friendly primary keys: any application server can mint one without asking the database, so inserts never block on ID generation. The embedded timestamp also lets you extract creation time later, which is exactly what the companion ObjectId timestamp tool does.