0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/sharding/mongos_dataSize_test.js
2019-07-27 11:02:23 -04:00

15 lines
631 B
JavaScript

// 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();
})();