blob: d6d1fcf5c84d1925c31a62f3abfa2cc347c9162b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
(function() {
var st = new ShardingTest({shards: 2});
var configDB = st.s.getDB('config');
assert.commandWorked(configDB.adminCommand({enableSharding: 'test'}));
st.ensurePrimaryShard('test', st.shard1.shardName);
assert.commandWorked(configDB.adminCommand(
{shardCollection: 'test.user', key: {x: 'hashed'}, numInitialChunks: 2}));
var metadata = st.rs0.getPrimary().getDB('admin').runCommand(
{getShardVersion: 'test.user', fullMetadata: true});
var chunks =
metadata.metadata.chunks.length > 0 ? metadata.metadata.chunks : metadata.metadata.pending;
assert(bsonWoCompare(chunks[0][0], chunks[0][1]) < 0, tojson(metadata));
metadata = st.rs1.getPrimary().getDB('admin').runCommand(
{getShardVersion: 'test.user', fullMetadata: true});
chunks =
metadata.metadata.chunks.length > 0 ? metadata.metadata.chunks : metadata.metadata.pending;
assert(bsonWoCompare(chunks[0][0], chunks[0][1]) < 0, tojson(metadata));
st.stop();
})();
|