Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57783

update7.js is not resilient to ObjectID wraparound

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Execution Team 2021-07-26
    • 20

      The udpate7 test asserts that the documents with 'x' values 1,2,3, inserted in that order, return in the same order when sorted by _id.

      function s() {
          return t.find().sort({_id: 1}).map(function(z) {
              return z.x;
          });
      }
      // snip
      t.save({x: 1});
      t.save({x: 2});
      t.save({x: 3});
       
      t.createIndex({x: 1});
       
      assert.eq("1,2,3", s(), "F1");
      

      This test fails if the _id increment happens to wrap around in the same second that all 3 documents are inserted.

            Assignee:
            yuhong.zhang@mongodb.com Yuhong Zhang
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: