summaryrefslogtreecommitdiff
path: root/jstests/sharding/drop_configdb.js
blob: 1e338d0c2c5377aaf8ed3abf415ded19d87711ef (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
27
// Test that dropping the config database is completely disabled via
// mongos and via mongod, if started with --configsvr
//
// @tags: [requires_fcv_46]
(function() {
"use strict";

var st = new ShardingTest({shards: 2});
var mongos = st.s;
var config = st.configRS.getPrimary().getDB('config');

// Try to drop config db via configsvr

print("1: Try to drop config database via configsvr");
assert.eq(0, config.dropDatabase().ok);
assert.eq("Cannot drop 'config' database if mongod started with --configsvr",
          config.dropDatabase().errmsg);

// Try to drop config db via mongos
var config = mongos.getDB("config");

print("1: Try to drop config database via mongos");
assert.commandFailedWithCode(config.dropDatabase(), ErrorCodes.IllegalOperation);
assert.commandFailedWithCode(mongos.getDB("admin").dropDatabase(), ErrorCodes.IllegalOperation);

st.stop();
}());