blob: 9dc9ceac78f858be8915f928157494ac8434b1f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// This tests the command dataSize on sharded clusters to ensure that they can use the command.
(function() {
'use strict';
let s = new ShardingTest({shards: 2, mongos: 1});
let db = s.getDB("test");
assert.commandWorked(s.s0.adminCommand({enableSharding: "test"}));
assert.commandWorked(s.s0.adminCommand({shardcollection: "test.foo", key: {num: 1}}));
assert.commandWorked(s.getPrimaryShard("test").getDB("admin").runCommand({datasize: "test.foo"}));
assert.commandFailedWithCode(s.getPrimaryShard("test").getDB("admin").runCommand({datasize: "foo"}),
ErrorCodes.InvalidNamespace);
s.stop();
})();
|