summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@mongodb.com>2019-10-21 23:51:42 +0000
committerevergreen <evergreen@mongodb.com>2019-10-21 23:51:42 +0000
commitdb9291bfafb17427adb031ba0326d1acfc52bde0 (patch)
tree1e2e4dc2fbd7eec88237270d9a1dbea82ccb2d9b /src
parent39bfc190446acd0b049c5cb29dfbbc6574a40ce1 (diff)
downloadmongo-db9291bfafb17427adb031ba0326d1acfc52bde0.tar.gz
Revert "SERVER-42748 Support using stored procedures (system.js) in map/reduce"
This reverts commit 6eac52a928f7a949713f7e7c20468ea0ecba8946.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/pipeline/expression_context.h2
-rw-r--r--src/mongo/db/pipeline/javascript_execution.cpp3
-rw-r--r--src/mongo/db/pipeline/javascript_execution.h3
-rw-r--r--src/mongo/scripting/engine.cpp2
-rw-r--r--src/mongo/scripting/engine.h5
5 files changed, 6 insertions, 9 deletions
diff --git a/src/mongo/db/pipeline/expression_context.h b/src/mongo/db/pipeline/expression_context.h
index e82d7bef9c5..c0b44e88da6 100644
--- a/src/mongo/db/pipeline/expression_context.h
+++ b/src/mongo/db/pipeline/expression_context.h
@@ -242,7 +242,7 @@ public:
auto getJsExecWithScope() const {
RuntimeConstants runtimeConstants = getRuntimeConstants();
const boost::optional<mongo::BSONObj>& scope = runtimeConstants.getJsScope();
- return JsExecution::get(opCtx, scope.get_value_or(BSONObj()), ns.db());
+ return JsExecution::get(opCtx, scope.get_value_or(BSONObj()));
}
// The explain verbosity requested by the user, or boost::none if no explain was requested.
diff --git a/src/mongo/db/pipeline/javascript_execution.cpp b/src/mongo/db/pipeline/javascript_execution.cpp
index 720fdad7f8e..ac8e474fb9c 100644
--- a/src/mongo/db/pipeline/javascript_execution.cpp
+++ b/src/mongo/db/pipeline/javascript_execution.cpp
@@ -37,11 +37,10 @@ namespace {
const auto getExec = OperationContext::declareDecoration<std::unique_ptr<JsExecution>>();
} // namespace
-JsExecution* JsExecution::get(OperationContext* opCtx, const BSONObj& scope, StringData database) {
+JsExecution* JsExecution::get(OperationContext* opCtx, const BSONObj& scope) {
auto& exec = getExec(opCtx);
if (!exec) {
exec = std::make_unique<JsExecution>(scope);
- exec->getScope()->setLocalDB(database);
exec->getScope()->loadStored(opCtx, true);
}
return exec.get();
diff --git a/src/mongo/db/pipeline/javascript_execution.h b/src/mongo/db/pipeline/javascript_execution.h
index 0a2d6f1219c..b62a2d2df12 100644
--- a/src/mongo/db/pipeline/javascript_execution.h
+++ b/src/mongo/db/pipeline/javascript_execution.h
@@ -29,7 +29,6 @@
#pragma once
-#include "mongo/base/string_data.h"
#include "mongo/db/client.h"
#include "mongo/db/exec/document_value/value.h"
#include "mongo/db/operation_context.h"
@@ -50,7 +49,7 @@ public:
* Create or get a pointer to a JsExecution instance, capable of invoking Javascript functions
* and reading the return value.
*/
- static JsExecution* get(OperationContext* opCtx, const BSONObj& scope, StringData database);
+ static JsExecution* get(OperationContext* opCtx, const BSONObj& scope);
/**
* Construct with a thread-local scope and initialize with the given scope variables.
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index eba9c50c9be..149da7f5969 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -421,7 +421,7 @@ public:
void init(const BSONObj* data) {
_real->init(data);
}
- void setLocalDB(StringData dbName) {
+ void setLocalDB(const string& dbName) {
_real->setLocalDB(dbName);
}
void loadStored(OperationContext* opCtx, bool ignoreNotConnected = false) {
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index 4f572cad026..b50c75baed6 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -29,7 +29,6 @@
#pragma once
-#include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/service_context.h"
#include "mongo/platform/atomic_word.h"
@@ -66,8 +65,8 @@ public:
}
virtual void externalSetup() = 0;
- virtual void setLocalDB(StringData localDBName) {
- _localDBName = localDBName.toString();
+ virtual void setLocalDB(const std::string& localDBName) {
+ _localDBName = localDBName;
}
virtual BSONObj getObject(const char* field) = 0;