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

explain command for cluster delete results in error when on shardsvr mongod

    • Fully Compatible
    • ALL

      If you use the explain command for a cluster delete on a shardsvr mongod, you get an error. However if you run the same command without the explain on a shardsvr mongod it works. 

      Code to reproduce the error:

      (function() {
      const kDBName = "foo";
      const kCollName = "bar";
      const st = new ShardingTest({mongos: 1, shards: 1, config: 1});const clusterCommandsCases = [
          // This does not error
          //{cmd: {clusterDelete: kCollName, deletes: [{q: {}, limit: 0}]}},    
      
          // This errors
          {cmd: {explain: {clusterDelete: `${kCollName}`, deletes: [{q: {}, limit: 0}]}}}
      ];
      
      assert.commandWorked(st.s0.adminCommand({enablesharding: kDBName}));
      assert.commandWorked(st.s0.adminCommand({shardcollection: kDBName + "." + kCollName, key: {a: 1}}));
      
      for (let testCase of clusterCommandsCases) {
          assert.commandWorked(st.rs0.getPrimary().getDB(kDBName).runCommand(testCase.cmd),
                               tojson(testCase.cmd));
      }
      
      st.stop();
      })(); 

            Assignee:
            wenqin.ye@mongodb.com Wenqin Ye
            Reporter:
            wenqin.ye@mongodb.com Wenqin Ye
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: