summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/javascript_execution.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/javascript_execution.h')
-rw-r--r--src/mongo/db/pipeline/javascript_execution.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/javascript_execution.h b/src/mongo/db/pipeline/javascript_execution.h
index d95e90f6eea..a66dee6c6ca 100644
--- a/src/mongo/db/pipeline/javascript_execution.h
+++ b/src/mongo/db/pipeline/javascript_execution.h
@@ -58,6 +58,15 @@ public:
StringData database,
bool loadStoredProcedures,
boost::optional<int> jsHeapLimitMB);
+
+ /**
+ * Gets a pointer to the cached JsExecution instance if it exists, else returns nullptr. This
+ * allows the caller to skip passing all the arguments to the more general JsExecution::get()
+ * method, which avoids having to potentially construct and create a heap copy of a large scope
+ * object that will not be used because a cached JsExecution object already exists.
+ */
+ static JsExecution* getCached(OperationContext* opCtx, bool loadStoredProcedures);
+
/**
* Construct with a thread-local scope and initialize with the given scope variables.
*/