summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-05-07 13:05:00 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-05-13 22:53:52 -0400
commitcfd65015b39fe7b0db6aec288f69163bc5763812 (patch)
tree20b1be6bf4030c03d802ffee6666421db6020592 /src/mongo/shell
parent4309c3c77f28ccc27760e4781797b1d2afd8cb06 (diff)
downloadmongo-cfd65015b39fe7b0db6aec288f69163bc5763812.tar.gz
SERVER-40712 Ensure the dropDatabase() command accepts a write concern.
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/db.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 43123fd9361..2d9f0789db9 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -4,6 +4,8 @@ var DB;
(function() {
+ var _defaultWriteConcern = {w: 'majority', wtimeout: 10 * 60 * 1000};
+
if (DB === undefined) {
DB = function(mongo, name) {
this._mongo = mongo;
@@ -386,14 +388,13 @@ var DB;
};
/**
- Erase the entire database. (!)
-
+ * Erase the entire database.
+ * @params writeConcern: (document) expresses the write concern of the drop command.
* @return Object returned has member ok set to true if operation succeeds, false otherwise.
*/
- DB.prototype.dropDatabase = function() {
- if (arguments.length)
- throw Error("dropDatabase doesn't take arguments");
- return this._dbCommand({dropDatabase: 1});
+ DB.prototype.dropDatabase = function(writeConcern) {
+ return this._dbCommand(
+ {dropDatabase: 1, writeConcern: writeConcern ? writeConcern : _defaultWriteConcern});
};
/**
@@ -568,7 +569,7 @@ var DB;
print("\tdb.createUser(userDocument)");
print("\tdb.createView(name, viewOn, [{$operator: {...}}, ...], {viewOptions})");
print("\tdb.currentOp() displays currently executing operations in the db");
- print("\tdb.dropDatabase()");
+ print("\tdb.dropDatabase(writeConcern)");
print("\tdb.dropUser(username)");
print("\tdb.eval() - deprecated");
print("\tdb.fsyncLock() flush data to disk and lock server for backups");
@@ -1302,8 +1303,6 @@ var DB;
/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
- var _defaultWriteConcern = {w: 'majority', wtimeout: 10 * 60 * 1000};
-
function getUserObjString(userObj) {
var pwd = userObj.pwd;
delete userObj.pwd;