Files
mongo/jstests/sharding/move_primary_fails_without_database_version.js
2022-02-23 18:00:30 +00:00

16 lines
495 B
JavaScript

// Tests that a movePrimary will fail if the database doesn't have a version in config.databases
(function() {
"use strict";
const dbName = "test";
const st = new ShardingTest({shards: 2});
assert.commandWorked(st.s.getDB("config")
.getCollection("databases")
.insert({_id: dbName, partitioned: false, primary: st.shard0.shardName}));
assert.commandFailed(st.s.adminCommand({movePrimary: dbName, to: st.shard1.shardName}));
st.stop();
})();