Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-11330

single-threaded generation of ObjectIds can be non-monotonic

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None
    • 0.5

      We should clarify that even single-threaded generation of ObjectIds will sometimes be non-monotonic.

      From kevin.pulo,

      The ObjectId definition says that the 3-byte counter starts at a random value (and implicitly is incremented with each generated ObjectId). The current behaviour (in the server/shell at least) is to roll back to 0 after reaching 0xffffff. Unfortunately, when this happens any further ObjectIds generated by that thread during the same second will have a lower sort order (compared to the previously-generated ObjectIds during that second) — that is, single-threaded ObjectId generation is not always monotonic.

            Assignee:
            andrew.aldridge@mongodb.com Andrew Aldridge
            Reporter:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              6 years, 11 weeks ago