summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/matcher')
-rw-r--r--src/mongo/db/matcher/expression_text.cpp10
-rw-r--r--src/mongo/db/matcher/expression_text.h2
-rw-r--r--src/mongo/db/matcher/expression_where.cpp11
-rw-r--r--src/mongo/db/matcher/expression_where.h4
-rw-r--r--src/mongo/db/matcher/extensions_callback_real.cpp8
-rw-r--r--src/mongo/db/matcher/extensions_callback_real.h11
6 files changed, 24 insertions, 22 deletions
diff --git a/src/mongo/db/matcher/expression_text.cpp b/src/mongo/db/matcher/expression_text.cpp
index 8c8bd979cf8..9dcf093e591 100644
--- a/src/mongo/db/matcher/expression_text.cpp
+++ b/src/mongo/db/matcher/expression_text.cpp
@@ -41,7 +41,7 @@
namespace mongo {
-Status TextMatchExpression::init(OperationContext* txn,
+Status TextMatchExpression::init(OperationContext* opCtx,
const NamespaceString& nss,
TextParams params) {
_ftsQuery.setQuery(std::move(params.query));
@@ -52,9 +52,9 @@ Status TextMatchExpression::init(OperationContext* txn,
fts::TextIndexVersion version;
{
// Find text index.
- ScopedTransaction transaction(txn, MODE_IS);
- AutoGetDb autoDb(txn, nss.db(), MODE_IS);
- Lock::CollectionLock collLock(txn->lockState(), nss.ns(), MODE_IS);
+ ScopedTransaction transaction(opCtx, MODE_IS);
+ AutoGetDb autoDb(opCtx, nss.db(), MODE_IS);
+ Lock::CollectionLock collLock(opCtx->lockState(), nss.ns(), MODE_IS);
Database* db = autoDb.getDb();
if (!db) {
return {ErrorCodes::IndexNotFound,
@@ -70,7 +70,7 @@ Status TextMatchExpression::init(OperationContext* txn,
<< "')"};
}
std::vector<IndexDescriptor*> idxMatches;
- collection->getIndexCatalog()->findIndexByType(txn, IndexNames::TEXT, idxMatches);
+ collection->getIndexCatalog()->findIndexByType(opCtx, IndexNames::TEXT, idxMatches);
if (idxMatches.empty()) {
return {ErrorCodes::IndexNotFound, "text index required for $text query"};
}
diff --git a/src/mongo/db/matcher/expression_text.h b/src/mongo/db/matcher/expression_text.h
index 3bd44b29da3..bb5dbfb77b1 100644
--- a/src/mongo/db/matcher/expression_text.h
+++ b/src/mongo/db/matcher/expression_text.h
@@ -41,7 +41,7 @@ class OperationContext;
class TextMatchExpression : public TextMatchExpressionBase {
public:
- Status init(OperationContext* txn, const NamespaceString& nss, TextParams params);
+ Status init(OperationContext* opCtx, const NamespaceString& nss, TextParams params);
const fts::FTSQuery& getFTSQuery() const final {
return _ftsQuery;
diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp
index af678c9e5bb..c1d1b5d307c 100644
--- a/src/mongo/db/matcher/expression_where.cpp
+++ b/src/mongo/db/matcher/expression_where.cpp
@@ -50,9 +50,9 @@ using std::string;
using std::stringstream;
using stdx::make_unique;
-WhereMatchExpression::WhereMatchExpression(OperationContext* txn, WhereParams params)
- : WhereMatchExpressionBase(std::move(params)), _txn(txn) {
- invariant(_txn != NULL);
+WhereMatchExpression::WhereMatchExpression(OperationContext* opCtx, WhereParams params)
+ : WhereMatchExpressionBase(std::move(params)), _opCtx(opCtx) {
+ invariant(_opCtx != NULL);
_func = 0;
}
@@ -72,7 +72,7 @@ Status WhereMatchExpression::init(StringData dbName) {
AuthorizationSession::get(Client::getCurrent())->getAuthenticatedUserNamesToken();
try {
- _scope = getGlobalScriptEngine()->getPooledScope(_txn, _dbName, "where" + userToken);
+ _scope = getGlobalScriptEngine()->getPooledScope(_opCtx, _dbName, "where" + userToken);
_func = _scope->createFunction(getCode().c_str());
} catch (...) {
return exceptionToStatus();
@@ -112,7 +112,8 @@ unique_ptr<MatchExpression> WhereMatchExpression::shallowClone() const {
WhereParams params;
params.code = getCode();
params.scope = getScope();
- unique_ptr<WhereMatchExpression> e = make_unique<WhereMatchExpression>(_txn, std::move(params));
+ unique_ptr<WhereMatchExpression> e =
+ make_unique<WhereMatchExpression>(_opCtx, std::move(params));
e->init(_dbName);
if (getTag()) {
e->setTag(getTag()->clone());
diff --git a/src/mongo/db/matcher/expression_where.h b/src/mongo/db/matcher/expression_where.h
index 780c169b217..26b55e4f2ea 100644
--- a/src/mongo/db/matcher/expression_where.h
+++ b/src/mongo/db/matcher/expression_where.h
@@ -37,7 +37,7 @@ class OperationContext;
class WhereMatchExpression final : public WhereMatchExpressionBase {
public:
- WhereMatchExpression(OperationContext* txn, WhereParams params);
+ WhereMatchExpression(OperationContext* opCtx, WhereParams params);
Status init(StringData dbName);
@@ -51,7 +51,7 @@ private:
std::unique_ptr<Scope> _scope;
ScriptingFunction _func;
- OperationContext* const _txn;
+ OperationContext* const _opCtx;
};
} // namespace mongo
diff --git a/src/mongo/db/matcher/extensions_callback_real.cpp b/src/mongo/db/matcher/extensions_callback_real.cpp
index 0b7e815ca58..f61928b4e2c 100644
--- a/src/mongo/db/matcher/extensions_callback_real.cpp
+++ b/src/mongo/db/matcher/extensions_callback_real.cpp
@@ -36,8 +36,8 @@
namespace mongo {
-ExtensionsCallbackReal::ExtensionsCallbackReal(OperationContext* txn, const NamespaceString* nss)
- : _txn(txn), _nss(nss) {}
+ExtensionsCallbackReal::ExtensionsCallbackReal(OperationContext* opCtx, const NamespaceString* nss)
+ : _opCtx(opCtx), _nss(nss) {}
StatusWithMatchExpression ExtensionsCallbackReal::parseText(BSONElement text) const {
auto textParams = extractTextMatchExpressionParams(text);
@@ -46,7 +46,7 @@ StatusWithMatchExpression ExtensionsCallbackReal::parseText(BSONElement text) co
}
auto exp = stdx::make_unique<TextMatchExpression>();
- Status status = exp->init(_txn, *_nss, std::move(textParams.getValue()));
+ Status status = exp->init(_opCtx, *_nss, std::move(textParams.getValue()));
if (!status.isOK()) {
return status;
}
@@ -59,7 +59,7 @@ StatusWithMatchExpression ExtensionsCallbackReal::parseWhere(BSONElement where)
return whereParams.getStatus();
}
- auto exp = stdx::make_unique<WhereMatchExpression>(_txn, std::move(whereParams.getValue()));
+ auto exp = stdx::make_unique<WhereMatchExpression>(_opCtx, std::move(whereParams.getValue()));
Status status = exp->init(_nss->db());
if (!status.isOK()) {
return status;
diff --git a/src/mongo/db/matcher/extensions_callback_real.h b/src/mongo/db/matcher/extensions_callback_real.h
index 45b97e4b9c3..2cfbb043597 100644
--- a/src/mongo/db/matcher/extensions_callback_real.h
+++ b/src/mongo/db/matcher/extensions_callback_real.h
@@ -42,13 +42,14 @@ class OperationContext;
class ExtensionsCallbackReal : public ExtensionsCallback {
public:
/**
- * Does not take ownership of 'nss' or 'txn'.
+ * Does not take ownership of 'nss' or 'opCtx'.
*
- * 'nss' must outlive this object. 'txn' must outlive this object also; in addition, 'txn' must
+ * 'nss' must outlive this object. 'opCtx' must outlive this object also; in addition, 'opCtx'
+ * must
* outlive any MatchExpression objects generated by these callbacks (as the generated objects
- * are allowed to keep a reference to 'txn').
+ * are allowed to keep a reference to 'opCtx').
*/
- ExtensionsCallbackReal(OperationContext* txn, const NamespaceString* nss);
+ ExtensionsCallbackReal(OperationContext* opCtx, const NamespaceString* nss);
/**
* Returns a TextMatchExpression, or an error Status if parsing fails.
@@ -61,7 +62,7 @@ public:
StatusWithMatchExpression parseWhere(BSONElement where) const final;
private:
- OperationContext* const _txn;
+ OperationContext* const _opCtx;
const NamespaceString* const _nss;
};