(function() {
|
"use strict";
|
|
const st = new ShardingTest({mongos: 1, config: 1, shard: 2, rs: {nodes: 2}});
|
const mongosDB = st.s.getDB("test");
|
const mongosColl = mongosDB.mycoll;
|
|
// Enable sharding on the test DB and ensure its primary is shard0000.
|
assert.commandWorked(mongosDB.adminCommand({enableSharding: mongosDB.getName()}));
|
st.ensurePrimaryShard(mongosDB.getName(), st.rs0.getURL());
|
|
// Shard the test collection on the "x" field.
|
assert.commandWorked(mongosDB.adminCommand({
|
shardCollection: mongosColl.getFullName(),
|
key: {x: 1},
|
}));
|
|
// Insert a document with a literal undefined value.
|
assert.writeOK(mongosColl.insert({x: undefined}));
|
|
// Move the chunk containing the document to shard0001.
|
assert.commandWorked(mongosDB.adminCommand({
|
moveChunk: mongosColl.getFullName(),
|
find: {x: null},
|
to: st.rs1.getURL(),
|
_waitForDelete: true,
|
}));
|
|
// Wait for the secondary of shard0000 to process the deletion from the moveChunk operation.
|
st.rs0.awaitReplication();
|
|
st.stop();
|
})();
|