2
* Tests setShardVersion, particularly on the case where mongos sends it to a
3
* shard that does not have any chunks.
6
var st = new ShardingTest({ shards: 2, mongos: 2 });
9
var configDB = st.s.getDB('config');
10
configDB.adminCommand({ enableSharding: 'test' });
11
configDB.adminCommand({ movePrimary: 'test', to: 'shard0000' });
12
configDB.adminCommand({ shardCollection: 'test.user', key: { x: 1 }});
14
var testDB = st.s.getDB('test');
16
testDB.user.insert({ x: 1 });
17
testDB.runCommand({ getLastError: 1 });
19
var doc = testDB.user.findOne();
21
var testDB2 = st.s1.getDB('test');
23
configDB.adminCommand({ moveChunk: 'test.user', find: { x: 0 }, to: 'shard0001' });
25
assert.eq(1, testDB.user.find().itcount());
26
assert.eq(1, testDB2.user.find().itcount());
28
assert.eq(1, testDB.user.find({ x: 1 }).itcount());
29
assert.eq(1, testDB2.user.find({ x: 1 }).itcount());
31
var configDB2 = st.s1.getDB('config');
32
configDB2.adminCommand({ moveChunk: 'test.user', find: { x: 0 }, to: 'shard0000' });
34
assert.eq(1, testDB.user.find().itcount());
35
assert.eq(1, testDB2.user.find().itcount());
37
assert.eq(1, testDB.user.find({ x: 1 }).itcount());
38
assert.eq(1, testDB2.user.find({ x: 1 }).itcount());