blob: fe8cef3e0d386d3106aa0ca4b967a42a1137cba8 (
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
|
(function() {
var st = new ShardingTest({shards: 2});
var configDB = st.s.getDB('config');
assert.commandWorked(configDB.adminCommand({enableSharding: 'test'}));
st.ensurePrimaryShard('test', 'shard0001');
assert.commandWorked(configDB.adminCommand(
{shardCollection: 'test.user', key: {x: 'hashed'}, numInitialChunks: 2}));
var metadata =
st.d0.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.d1.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();
})();
|