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

single-threaded generation of ObjectIds can be non-monotonic

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None
    • 0.5

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              5 years, 51 weeks, 6 days ago