ObjectId

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: BSON types and field properties

What it does

A 12-byte identifier commonly used for _id; includes a timestamp component.

Syntax

ObjectId("24-hex-character-string")

Use case

Document identifiers and references.

Important notes

Use explicit business timestamps for business events.

ObjectId: practical example
ObjectId("65a000000000000000000001")
💡 Explanation A 12-byte identifier commonly used for _id; includes a timestamp component. When to use it Document identifiers and references. Caution Use explicit business timestamps for business events.
Key Takeaways
  • A 12-byte identifier commonly used for _id; includes a timestamp component.
  • Typical use: Document identifiers and references.