summaryrefslogtreecommitdiff
path: root/src/mongo/scripting
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-03-10 09:51:50 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-03-10 11:30:07 -0500
commit44d8a4dd0f8f27b72e2040e2bde74c552739eb23 (patch)
tree97a8934b6dd2a39a2bccfe0b479182dab789ea3f /src/mongo/scripting
parent6efa681435ec30467ca88edc449b241bb2c326bf (diff)
downloadmongo-44d8a4dd0f8f27b72e2040e2bde74c552739eb23.tar.gz
SERVER-22359 Move ensureShardVersionOkOrThrow to CollectionShardingState
This ensures that we will have assertions in place for the correct locks being held.
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r--src/mongo/scripting/mozjs/db.cpp3
-rw-r--r--src/mongo/scripting/mozjs/dbcollection.cpp3
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/scripting/mozjs/db.cpp b/src/mongo/scripting/mozjs/db.cpp
index 0a107ba3953..97112595037 100644
--- a/src/mongo/scripting/mozjs/db.cpp
+++ b/src/mongo/scripting/mozjs/db.cpp
@@ -59,8 +59,7 @@ void DBInfo::getProperty(JSContext* cx,
if (o.hasOwnField(InternedString::_fullName)) {
// need to check every time that the collection did not get sharded
- if (haveLocalShardingInfo(opContext->getClient(),
- o.getString(InternedString::_fullName)))
+ if (haveLocalShardingInfo(opContext, o.getString(InternedString::_fullName)))
uasserted(ErrorCodes::BadValue, "can't use sharded collection from db.eval");
}
}
diff --git a/src/mongo/scripting/mozjs/dbcollection.cpp b/src/mongo/scripting/mozjs/dbcollection.cpp
index 2cc03a752e1..8d094721f8f 100644
--- a/src/mongo/scripting/mozjs/dbcollection.cpp
+++ b/src/mongo/scripting/mozjs/dbcollection.cpp
@@ -75,8 +75,9 @@ void DBCollectionInfo::construct(JSContext* cx, JS::CallArgs args) {
std::string fullName = ValueWriter(cx, args.get(3)).toString();
auto context = scope->getOpContext();
- if (context && haveLocalShardingInfo(context->getClient(), fullName))
+ if (context && haveLocalShardingInfo(context, fullName)) {
uasserted(ErrorCodes::BadValue, "can't use sharded collection from db.eval");
+ }
args.rval().setObjectOrNull(thisv);
}