summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/sharded_distinct.js
blob: 4b50586e6fbf6ff555499f59a21efd6d7be969be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Verifies that sharded distinct command parsing and response processing is robust. Designed to
 * reproduce BF-22480.
 *
 * @tags: [requires_sharding]
 */
(function() {
"use strict";
const st = new ShardingTest({shards: 1, mongos: 1});
const dbName = "db";
const db = st.getDB(dbName);
const coll = db[jsTestName()];
const helpFn = function() {
    return "foo";
};

assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));
assert.commandWorked(st.s.adminCommand({shardCollection: coll.getFullName(), key: {a: 1}}));
assert.commandFailed(coll.runCommand("distinct", {help: helpFn, foo: 1}));
assert.commandFailed(coll.runCommand(
    {explain: {distinct: coll.getName(), help: helpFn, foo: 1}, verbosity: 'queryPlanner'}));
st.stop();
})();