summaryrefslogtreecommitdiff
path: root/src/mongo/shell/mongo.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/mongo.js')
-rw-r--r--src/mongo/shell/mongo.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/shell/mongo.js b/src/mongo/shell/mongo.js
index 796bfdcbf92..aad971d5092 100644
--- a/src/mongo/shell/mongo.js
+++ b/src/mongo/shell/mongo.js
@@ -108,11 +108,9 @@ Mongo.prototype.getDB = function(name) {
((typeof this.authenticated == 'undefined') || !this.authenticated)) {
jsTest.authenticate(this);
}
- // There is a weird issue where typeof(db._name) !== "string" when the db name
- // is created from objects returned from native C++ methods.
- // This hack ensures that the db._name is always a string.
- if (typeof(name) === "object") {
- name = name.toString();
+ if (typeof name != 'string') {
+ throw Error('getDB failed: db name must be a string: (type: ' + (typeof name) + ') ' +
+ tojson(name));
}
return new DB(this, name);
};