Decode any MongoDB ObjectID to extract its embedded creation timestamp, random bytes, and counter. See exactly when a document was created without a separate createdAt field. Also generates new ObjectIDs.
Free, no sign-up — one of the SaaSQuickStart Developer tools.
Yes. Because the first 4 bytes of every ObjectID are a timestamp, you can query _id with $gt/$lt using ObjectIDs constructed from known timestamps. This is exactly how the snippet above works.
They are generated to be globally unique across a distributed system, but MongoDB does not enforce uniqueness across different collections — only within the _id index of a single collection.
The timestamp part is real (current time). The random and counter parts are generated in the browser using crypto.getRandomValues(), which is cryptographically secure. The result is a valid ObjectID that MongoDB would accept.