update7.js is not resilient to ObjectID wraparound

XMLWordPrintableJSON

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

      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
            Reporter:
            Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: