Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1538

Running mongodump and mongorestore does not restore original index version

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: mongodump, mongorestore
    • Labels:
      None
    • Platforms 2017-01-23
    • Not Needed
    • v3.4

      Repro:

      (function() {
      
        if (typeof getToolTest === 'undefined') {
          load('jstests/configs/plain_28.config.js');
        }
      
        var toolTest = getToolTest('indexes');
        var commonToolArgs = getCommonToolArguments();
      
        // where we'll put the dump
        var dumpTarget = 'indexes_dump';
        resetDbpath(dumpTarget);
      
        // the db and collection we will use
        var testDB = toolTest.db.getSiblingDB('test');
        var testColl = testDB.coll;
      
        // create v:1 index
        testColl.ensureIndex({v1_field: 1}, {name: "v1_field_1", v: 1});
        var indexSpec = testColl.getIndexes().filter(spec => spec.name === "v1_field_1")[0];
        assert.eq(1, indexSpec.v);
        
        // dump the data
        var ret = toolTest.runTool.apply(toolTest, ['dump']
          .concat(getDumpTarget(dumpTarget))
          .concat(commonToolArgs));
        assert.eq(0, ret);
      
        // drop the collection
        testColl.drop();
      
        // restore the data
        ret = toolTest.runTool.apply(toolTest, ['restore']
          .concat(getRestoreTarget(dumpTarget))
          .concat(commonToolArgs));
        assert.eq(0, ret);
      
        indexSpec = testColl.getIndexes().filter(spec => spec.name === "v1_field_1")[0];
        // this assertion should pass, but it fails
        assert.eq(1, indexSpec.v);
      
        // success
        toolTest.stop();
      }());
      

            Assignee:
            matt.cotter Matt Cotter
            Reporter:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: