-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
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(); })();