summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2015-10-29 14:31:11 -0400
committerJason Rassi <rassi@10gen.com>2015-11-05 13:56:56 -0500
commit3b76b83742bcd2124abe38718ad5c68bd72b2fc8 (patch)
tree0532d5550115fc72cb8c1db10d935f644c392bf9
parentc6d730bfed0c3ec374b35c4fd5b2badaa9bd8fc6 (diff)
downloadmongo-3b76b83742bcd2124abe38718ad5c68bd72b2fc8.tar.gz
SERVER-19510 Rename MatchExpressionParser::WhereCallback
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_mock.cpp2
-rw-r--r--src/mongo/db/commands/current_op.cpp4
-rw-r--r--src/mongo/db/commands/find_cmd.cpp8
-rw-r--r--src/mongo/db/commands/geo_near_cmd.cpp4
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp4
-rw-r--r--src/mongo/db/commands/mr.cpp8
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp6
-rw-r--r--src/mongo/db/dbhelpers.cpp4
-rw-r--r--src/mongo/db/exec/projection.cpp2
-rw-r--r--src/mongo/db/exec/projection.h6
-rw-r--r--src/mongo/db/exec/projection_exec.cpp4
-rw-r--r--src/mongo/db/exec/projection_exec.h4
-rw-r--r--src/mongo/db/exec/sort_key_generator.cpp4
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp2
-rw-r--r--src/mongo/db/exec/subplan.cpp4
-rw-r--r--src/mongo/db/matcher/expression_parser.cpp4
-rw-r--r--src/mongo/db/matcher/expression_parser.h24
-rw-r--r--src/mongo/db/matcher/expression_where.cpp6
-rw-r--r--src/mongo/db/matcher/expression_where_noop.cpp4
-rw-r--r--src/mongo/db/matcher/matcher.cpp5
-rw-r--r--src/mongo/db/matcher/matcher.h4
-rw-r--r--src/mongo/db/ops/modifier_pull.cpp2
-rw-r--r--src/mongo/db/ops/parsed_delete.cpp4
-rw-r--r--src/mongo/db/ops/parsed_update.cpp4
-rw-r--r--src/mongo/db/ops/path_support_test.cpp2
-rw-r--r--src/mongo/db/ops/update_driver.cpp4
-rw-r--r--src/mongo/db/pipeline/document_source_match.cpp4
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp6
-rw-r--r--src/mongo/db/query/canonical_query.cpp52
-rw-r--r--src/mongo/db/query/canonical_query.h42
-rw-r--r--src/mongo/db/query/find.cpp2
-rw-r--r--src/mongo/db/query/get_executor.cpp25
-rw-r--r--src/mongo/db/query/parsed_projection.cpp4
-rw-r--r--src/mongo/db/query/parsed_projection.h4
-rw-r--r--src/mongo/db/query/query_planner_test_fixture.cpp4
-rw-r--r--src/mongo/db/query/stage_builder.cpp2
-rw-r--r--src/mongo/dbtests/matchertests.cpp26
-rw-r--r--src/mongo/s/chunk_manager.cpp2
-rw-r--r--src/mongo/s/chunk_manager_targeter_test.cpp2
-rw-r--r--src/mongo/s/commands/cluster_find_cmd.cpp2
-rw-r--r--src/mongo/s/shard_key_pattern.cpp2
-rw-r--r--src/mongo/s/strategy.cpp2
42 files changed, 157 insertions, 153 deletions
diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.cpp b/src/mongo/db/auth/authz_manager_external_state_mock.cpp
index d58906dc8d6..797d6a147ea 100644
--- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp
@@ -274,7 +274,7 @@ Status AuthzManagerExternalStateMock::_queryVector(
const BSONObj& query,
std::vector<BSONObjCollection::iterator>* result) {
StatusWithMatchExpression parseResult =
- MatchExpressionParser::parse(query, MatchExpressionParser::WhereCallback());
+ MatchExpressionParser::parse(query, MatchExpressionParser::ExtensionsCallback());
if (!parseResult.isOK()) {
return parseResult.getStatus();
}
diff --git a/src/mongo/db/commands/current_op.cpp b/src/mongo/db/commands/current_op.cpp
index 5107a43d5c5..cd21548445f 100644
--- a/src/mongo/db/commands/current_op.cpp
+++ b/src/mongo/db/commands/current_op.cpp
@@ -98,8 +98,8 @@ public:
filter = b.obj();
}
- const WhereCallbackReal whereCallback(txn, db);
- const Matcher matcher(filter, whereCallback);
+ const ExtensionsCallbackReal extensionsCallback(txn, db);
+ const Matcher matcher(filter, extensionsCallback);
BSONArrayBuilder inprogBuilder(result.subarrayStart("inprog"));
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index f7935b00a36..8a003a0392d 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -142,9 +142,9 @@ public:
// Finish the parsing step by using the LiteParsedQuery to create a CanonicalQuery.
- WhereCallbackReal whereCallback(txn, nss.db());
+ ExtensionsCallbackReal extensionsCallback(txn, nss.db());
auto statusWithCQ =
- CanonicalQuery::canonicalize(lpqStatus.getValue().release(), whereCallback);
+ CanonicalQuery::canonicalize(lpqStatus.getValue().release(), extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
@@ -229,8 +229,8 @@ public:
beginQueryOp(txn, nss, cmdObj, ntoreturn, ntoskip);
// Finish the parsing step by using the LiteParsedQuery to create a CanonicalQuery.
- WhereCallbackReal whereCallback(txn, nss.db());
- auto statusWithCQ = CanonicalQuery::canonicalize(lpq.release(), whereCallback);
+ ExtensionsCallbackReal extensionsCallback(txn, nss.db());
+ auto statusWithCQ = CanonicalQuery::canonicalize(lpq.release(), extensionsCallback);
if (!statusWithCQ.isOK()) {
return appendCommandStatus(result, statusWithCQ.getStatus());
}
diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp
index 8f645dfd054..eb14ec362f8 100644
--- a/src/mongo/db/commands/geo_near_cmd.cpp
+++ b/src/mongo/db/commands/geo_near_cmd.cpp
@@ -185,9 +185,9 @@ public:
BSONObj projObj = BSON("$pt" << BSON("$meta" << LiteParsedQuery::metaGeoNearPoint) << "$dis"
<< BSON("$meta" << LiteParsedQuery::metaGeoNearDistance));
- const WhereCallbackReal whereCallback(txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(txn, nss.db());
auto statusWithCQ = CanonicalQuery::canonicalize(
- nss, rewritten, BSONObj(), projObj, 0, numWanted, BSONObj(), whereCallback);
+ nss, rewritten, BSONObj(), projObj, 0, numWanted, BSONObj(), extensionsCallback);
if (!statusWithCQ.isOK()) {
errmsg = "Can't parse filter / create query";
return false;
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index b4dd3e36d68..35e58acdc83 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -297,7 +297,7 @@ Status ClearFilters::clear(OperationContext* txn,
querySettings->clearAllowedIndices();
const NamespaceString nss(ns);
- const WhereCallbackReal whereCallback(txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(txn, nss.db());
// Remove corresponding entries from plan cache.
// Admin hints affect the planning process directly. If there were
@@ -315,7 +315,7 @@ Status ClearFilters::clear(OperationContext* txn,
// Create canonical query.
auto statusWithCQ = CanonicalQuery::canonicalize(
- nss, entry->query, entry->sort, entry->projection, whereCallback);
+ nss, entry->query, entry->sort, entry->projection, extensionsCallback);
invariant(statusWithCQ.isOK());
std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index ddac287ba86..b45082e065f 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -1016,10 +1016,10 @@ void State::finalReduce(CurOp* op, ProgressMeterHolder& pm) {
}
const NamespaceString nss(_config.incLong);
- const WhereCallbackReal whereCallback(_txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(_txn, nss.db());
auto statusWithCQ =
- CanonicalQuery::canonicalize(nss, BSONObj(), sortKey, BSONObj(), whereCallback);
+ CanonicalQuery::canonicalize(nss, BSONObj(), sortKey, BSONObj(), extensionsCallback);
verify(statusWithCQ.isOK());
std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
@@ -1371,10 +1371,10 @@ public:
unique_ptr<ScopedTransaction> scopedXact(new ScopedTransaction(txn, MODE_IS));
unique_ptr<AutoGetDb> scopedAutoDb(new AutoGetDb(txn, nss.db(), MODE_S));
- const WhereCallbackReal whereCallback(txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(txn, nss.db());
auto statusWithCQ = CanonicalQuery::canonicalize(
- nss, config.filter, config.sort, BSONObj(), whereCallback);
+ nss, config.filter, config.sort, BSONObj(), extensionsCallback);
if (!statusWithCQ.isOK()) {
uasserted(17238, "Can't canonicalize query " + config.filter.toString());
return 0;
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index 632c672b509..ee390ecb5c2 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -207,10 +207,10 @@ StatusWith<unique_ptr<CanonicalQuery>> PlanCacheCommand::canonicalize(OperationC
// Create canonical query
const NamespaceString nss(ns);
- const WhereCallbackReal whereCallback(txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(txn, nss.db());
- auto statusWithCQ =
- CanonicalQuery::canonicalize(std::move(nss), queryObj, sortObj, projObj, whereCallback);
+ auto statusWithCQ = CanonicalQuery::canonicalize(
+ std::move(nss), queryObj, sortObj, projObj, extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 999a2c8250e..23183f52f55 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -129,9 +129,9 @@ RecordId Helpers::findOne(OperationContext* txn,
if (!collection)
return RecordId();
- const WhereCallbackReal whereCallback(txn, collection->ns().db());
+ const ExtensionsCallbackReal extensionsCallback(txn, collection->ns().db());
- auto statusWithCQ = CanonicalQuery::canonicalize(collection->ns(), query, whereCallback);
+ auto statusWithCQ = CanonicalQuery::canonicalize(collection->ns(), query, extensionsCallback);
massert(17244, "Could not canonicalize " + query.toString(), statusWithCQ.isOK());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp
index a9e60bdace9..95f5a7112f3 100644
--- a/src/mongo/db/exec/projection.cpp
+++ b/src/mongo/db/exec/projection.cpp
@@ -62,7 +62,7 @@ ProjectionStage::ProjectionStage(OperationContext* opCtx,
if (ProjectionStageParams::NO_FAST_PATH == _projImpl) {
_exec.reset(
- new ProjectionExec(params.projObj, params.fullExpression, *params.whereCallback));
+ new ProjectionExec(params.projObj, params.fullExpression, *params.extensionsCallback));
} else {
// We shouldn't need the full expression if we're fast-pathing.
invariant(NULL == params.fullExpression);
diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h
index c8652a2fe8e..389abcc2123 100644
--- a/src/mongo/db/exec/projection.h
+++ b/src/mongo/db/exec/projection.h
@@ -49,8 +49,8 @@ struct ProjectionStageParams {
SIMPLE_DOC
};
- ProjectionStageParams(const MatchExpressionParser::WhereCallback& wc)
- : projImpl(NO_FAST_PATH), fullExpression(NULL), whereCallback(&wc) {}
+ ProjectionStageParams(const MatchExpressionParser::ExtensionsCallback& wc)
+ : projImpl(NO_FAST_PATH), fullExpression(NULL), extensionsCallback(&wc) {}
ProjectionImplementation projImpl;
@@ -67,7 +67,7 @@ struct ProjectionStageParams {
BSONObj coveredKeyObj;
// Used for creating context for the $where clause processing. Not owned.
- const MatchExpressionParser::WhereCallback* whereCallback;
+ const MatchExpressionParser::ExtensionsCallback* extensionsCallback;
};
/**
diff --git a/src/mongo/db/exec/projection_exec.cpp b/src/mongo/db/exec/projection_exec.cpp
index b5d83349cba..d0eb29d1827 100644
--- a/src/mongo/db/exec/projection_exec.cpp
+++ b/src/mongo/db/exec/projection_exec.cpp
@@ -74,7 +74,7 @@ ProjectionExec::ProjectionExec()
ProjectionExec::ProjectionExec(const BSONObj& spec,
const MatchExpression* queryExpression,
- const MatchExpressionParser::WhereCallback& whereCallback)
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback)
: _include(true),
_special(false),
_source(spec),
@@ -126,7 +126,7 @@ ProjectionExec::ProjectionExec(const BSONObj& spec,
verify(elemMatchObj.isOwned());
_elemMatchObjs.push_back(elemMatchObj);
StatusWithMatchExpression statusWithMatcher =
- MatchExpressionParser::parse(elemMatchObj, whereCallback);
+ MatchExpressionParser::parse(elemMatchObj, extensionsCallback);
verify(statusWithMatcher.isOK());
// And store it in _matchers.
_matchers[mongoutils::str::before(e.fieldName(), '.').c_str()] =
diff --git a/src/mongo/db/exec/projection_exec.h b/src/mongo/db/exec/projection_exec.h
index 3248844b6b7..9be352118d3 100644
--- a/src/mongo/db/exec/projection_exec.h
+++ b/src/mongo/db/exec/projection_exec.h
@@ -66,8 +66,8 @@ public:
ProjectionExec(const BSONObj& spec,
const MatchExpression* queryExpression,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
~ProjectionExec();
/**
diff --git a/src/mongo/db/exec/sort_key_generator.cpp b/src/mongo/db/exec/sort_key_generator.cpp
index 7c4be13bc0d..0287c2287f6 100644
--- a/src/mongo/db/exec/sort_key_generator.cpp
+++ b/src/mongo/db/exec/sort_key_generator.cpp
@@ -224,8 +224,8 @@ void SortKeyGenerator::getBoundsForSort(const BSONObj& queryObj, const BSONObj&
sortObj, IndexNames::BTREE, true, false, false, "doesnt_matter", NULL, BSONObj());
params.indices.push_back(sortOrder);
- auto statusWithQueryForSort =
- CanonicalQuery::canonicalize(NamespaceString("fake.ns"), queryObj, WhereCallbackNoop());
+ auto statusWithQueryForSort = CanonicalQuery::canonicalize(
+ NamespaceString("fake.ns"), queryObj, ExtensionsCallbackNoop());
verify(statusWithQueryForSort.isOK());
std::unique_ptr<CanonicalQuery> queryForSort = std::move(statusWithQueryForSort.getValue());
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index a3f5d29765e..af2ae4f86b3 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -244,7 +244,7 @@ public:
BSONObj argObj = e.Obj();
if (filterTag == e.fieldName()) {
StatusWithMatchExpression statusWithMatcher = MatchExpressionParser::parse(
- argObj, WhereCallbackReal(txn, collection->ns().db()));
+ argObj, ExtensionsCallbackReal(txn, collection->ns().db()));
if (!statusWithMatcher.isOK()) {
return NULL;
}
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index ad84fb6869d..2c4e4ea82b9 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -178,7 +178,7 @@ Status SubplanStage::planSubqueries() {
LOG(5) << "Subplanner: index " << i << " is " << ie.toString();
}
- const WhereCallbackReal whereCallback(getOpCtx(), _collection->ns().db());
+ const ExtensionsCallbackReal extensionsCallback(getOpCtx(), _collection->ns().db());
for (size_t i = 0; i < _orExpression->numChildren(); ++i) {
// We need a place to shove the results from planning this branch.
@@ -188,7 +188,7 @@ Status SubplanStage::planSubqueries() {
MatchExpression* orChild = _orExpression->getChild(i);
// Turn the i-th child into its own query.
- auto statusWithCQ = CanonicalQuery::canonicalize(*_query, orChild, whereCallback);
+ auto statusWithCQ = CanonicalQuery::canonicalize(*_query, orChild, extensionsCallback);
if (!statusWithCQ.isOK()) {
mongoutils::str::stream ss;
ss << "Can't canonicalize subchild " << orChild->toString() << " "
diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp
index 6b8eab0fea3..818c92c6376 100644
--- a/src/mongo/db/matcher/expression_parser.cpp
+++ b/src/mongo/db/matcher/expression_parser.cpp
@@ -326,7 +326,7 @@ StatusWithMatchExpression MatchExpressionParser::_parse(const BSONObj& obj, int
if (e.trueValue())
root->add(new AtomicMatchExpression());
} else if (mongoutils::str::equals("where", rest)) {
- StatusWithMatchExpression s = _whereCallback->parseWhere(e);
+ StatusWithMatchExpression s = _extensionsCallback->parseWhere(e);
if (!s.isOK())
return s;
root->add(s.getValue().release());
@@ -954,7 +954,7 @@ StatusWith<std::vector<uint32_t>> MatchExpressionParser::_parseBitPositionsArray
return bitPositions;
}
-StatusWithMatchExpression MatchExpressionParser::WhereCallback::parseWhere(
+StatusWithMatchExpression MatchExpressionParser::ExtensionsCallback::parseWhere(
const BSONElement& where) const {
return {Status(ErrorCodes::NoWhereParseContext, "no context for parsing $where")};
}
diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h
index fd9500801b4..754f6d41271 100644
--- a/src/mongo/db/matcher/expression_parser.h
+++ b/src/mongo/db/matcher/expression_parser.h
@@ -53,26 +53,26 @@ public:
*
* Do not use this class to pass-in generic context as it should only be used for $where.
*/
- class WhereCallback {
+ class ExtensionsCallback {
public:
virtual StatusWithMatchExpression parseWhere(const BSONElement& where) const;
- virtual ~WhereCallback() {}
+ virtual ~ExtensionsCallback() {}
};
/**
* caller has to maintain ownership obj
* the tree has views (BSONElement) into obj
*/
- static StatusWithMatchExpression parse(const BSONObj& obj,
- const WhereCallback& whereCallback = WhereCallback()) {
+ static StatusWithMatchExpression parse(
+ const BSONObj& obj, const ExtensionsCallback& extensionsCallback = ExtensionsCallback()) {
// The 0 initializes the match expression tree depth.
- return MatchExpressionParser(&whereCallback)._parse(obj, 0);
+ return MatchExpressionParser(&extensionsCallback)._parse(obj, 0);
}
private:
- explicit MatchExpressionParser(const WhereCallback* whereCallback)
- : _whereCallback(whereCallback) {}
+ explicit MatchExpressionParser(const ExtensionsCallback* extensionsCallback)
+ : _extensionsCallback(extensionsCallback) {}
/**
* 5 = false
@@ -164,20 +164,20 @@ private:
// Performs parsing for the $where clause. We do not own this pointer - it has to live
// as long as the parser is active.
- const WhereCallback* _whereCallback;
+ const ExtensionsCallback* _extensionsCallback;
};
/**
* This implementation is used for the server-side code.
*/
-class WhereCallbackReal : public MatchExpressionParser::WhereCallback {
+class ExtensionsCallbackReal : public MatchExpressionParser::ExtensionsCallback {
public:
/**
* The OperationContext passed here is not owned, but just referenced. It gets assigned to
* any $where parsers, which this callback generates. Therefore, the op context must only
* be destroyed after these parsers and their clones (shallowClone) have been destroyed.
*/
- WhereCallbackReal(OperationContext* txn, StringData dbName);
+ ExtensionsCallbackReal(OperationContext* txn, StringData dbName);
virtual StatusWithMatchExpression parseWhere(const BSONElement& where) const;
@@ -190,9 +190,9 @@ private:
/**
* This is just a pass-through implementation, used by sharding only.
*/
-class WhereCallbackNoop : public MatchExpressionParser::WhereCallback {
+class ExtensionsCallbackNoop : public MatchExpressionParser::ExtensionsCallback {
public:
- WhereCallbackNoop();
+ ExtensionsCallbackNoop();
virtual StatusWithMatchExpression parseWhere(const BSONElement& where) const;
};
diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp
index 8f26ad7ca1e..ea126d6d1c7 100644
--- a/src/mongo/db/matcher/expression_where.cpp
+++ b/src/mongo/db/matcher/expression_where.cpp
@@ -94,7 +94,7 @@ private:
unique_ptr<Scope> _scope;
ScriptingFunction _func;
- // Not owned. See comments insde WhereCallbackReal for the lifetime of this pointer.
+ // Not owned. See comments insde ExtensionsCallbackReal for the lifetime of this pointer.
OperationContext* _txn;
};
@@ -177,10 +177,10 @@ bool WhereMatchExpression::equivalent(const MatchExpression* other) const {
_userScope == realOther->_userScope;
}
-WhereCallbackReal::WhereCallbackReal(OperationContext* txn, StringData dbName)
+ExtensionsCallbackReal::ExtensionsCallbackReal(OperationContext* txn, StringData dbName)
: _txn(txn), _dbName(dbName) {}
-StatusWithMatchExpression WhereCallbackReal::parseWhere(const BSONElement& where) const {
+StatusWithMatchExpression ExtensionsCallbackReal::parseWhere(const BSONElement& where) const {
if (!globalScriptEngine)
return StatusWithMatchExpression(ErrorCodes::BadValue,
"no globalScriptEngine in $where parsing");
diff --git a/src/mongo/db/matcher/expression_where_noop.cpp b/src/mongo/db/matcher/expression_where_noop.cpp
index a9db9b0413b..ccb64190690 100644
--- a/src/mongo/db/matcher/expression_where_noop.cpp
+++ b/src/mongo/db/matcher/expression_where_noop.cpp
@@ -115,9 +115,9 @@ bool WhereNoOpMatchExpression::equivalent(const MatchExpression* other) const {
// -----------------
-WhereCallbackNoop::WhereCallbackNoop() {}
+ExtensionsCallbackNoop::ExtensionsCallbackNoop() {}
-StatusWithMatchExpression WhereCallbackNoop::parseWhere(const BSONElement& where) const {
+StatusWithMatchExpression ExtensionsCallbackNoop::parseWhere(const BSONElement& where) const {
unique_ptr<WhereNoOpMatchExpression> exp(new WhereNoOpMatchExpression());
if (where.type() == String || where.type() == Code) {
Status s = exp->init(where.valuestr());
diff --git a/src/mongo/db/matcher/matcher.cpp b/src/mongo/db/matcher/matcher.cpp
index df9a7fe71e1..1275a5c4408 100644
--- a/src/mongo/db/matcher/matcher.cpp
+++ b/src/mongo/db/matcher/matcher.cpp
@@ -41,10 +41,11 @@
namespace mongo {
-Matcher::Matcher(const BSONObj& pattern, const MatchExpressionParser::WhereCallback& whereCallback)
+Matcher::Matcher(const BSONObj& pattern,
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback)
: _pattern(pattern) {
StatusWithMatchExpression statusWithMatcher =
- MatchExpressionParser::parse(pattern, whereCallback);
+ MatchExpressionParser::parse(pattern, extensionsCallback);
uassert(16810,
mongoutils::str::stream() << "bad query: " << statusWithMatcher.getStatus().toString(),
statusWithMatcher.isOK());
diff --git a/src/mongo/db/matcher/matcher.h b/src/mongo/db/matcher/matcher.h
index e7ea9d93f1a..c1369c154cf 100644
--- a/src/mongo/db/matcher/matcher.h
+++ b/src/mongo/db/matcher/matcher.h
@@ -49,8 +49,8 @@ class Matcher {
public:
explicit Matcher(const BSONObj& pattern,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
bool matches(const BSONObj& doc, MatchDetails* details = NULL) const;
diff --git a/src/mongo/db/ops/modifier_pull.cpp b/src/mongo/db/ops/modifier_pull.cpp
index b644c87d12d..2772b7632b0 100644
--- a/src/mongo/db/ops/modifier_pull.cpp
+++ b/src/mongo/db/ops/modifier_pull.cpp
@@ -118,7 +118,7 @@ Status ModifierPull::init(const BSONElement& modExpr, const Options& opts, bool*
// Build the matcher around the object we built above. Currently, we do not allow
// $pull operations to contain $where clauses, so preserving this behaviour.
StatusWithMatchExpression parseResult =
- MatchExpressionParser::parse(_exprObj, MatchExpressionParser::WhereCallback());
+ MatchExpressionParser::parse(_exprObj, MatchExpressionParser::ExtensionsCallback());
if (!parseResult.isOK()) {
return parseResult.getStatus();
}
diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp
index e8fcaac5773..70a8cad6796 100644
--- a/src/mongo/db/ops/parsed_delete.cpp
+++ b/src/mongo/db/ops/parsed_delete.cpp
@@ -69,7 +69,7 @@ Status ParsedDelete::parseRequest() {
Status ParsedDelete::parseQueryToCQ() {
dassert(!_canonicalQuery.get());
- const WhereCallbackReal whereCallback(_txn, _request->getNamespaceString().db());
+ const ExtensionsCallbackReal extensionsCallback(_txn, _request->getNamespaceString().db());
// Limit should only used for the findAndModify command when a sort is specified. If a sort
// is requested, we want to use a top-k sort for efficiency reasons, so should pass the
@@ -93,7 +93,7 @@ Status ParsedDelete::parseQueryToCQ() {
emptyObj, // max
false, // snapshot
_request->isExplain(),
- whereCallback);
+ extensionsCallback);
if (statusWithCQ.isOK()) {
_canonicalQuery = std::move(statusWithCQ.getValue());
diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp
index 2fde7af84c9..38239175307 100644
--- a/src/mongo/db/ops/parsed_update.cpp
+++ b/src/mongo/db/ops/parsed_update.cpp
@@ -73,7 +73,7 @@ Status ParsedUpdate::parseQuery() {
Status ParsedUpdate::parseQueryToCQ() {
dassert(!_canonicalQuery.get());
- const WhereCallbackReal whereCallback(_txn, _request->getNamespaceString().db());
+ const ExtensionsCallbackReal extensionsCallback(_txn, _request->getNamespaceString().db());
// Limit should only used for the findAndModify command when a sort is specified. If a sort
// is requested, we want to use a top-k sort for efficiency reasons, so should pass the
@@ -97,7 +97,7 @@ Status ParsedUpdate::parseQueryToCQ() {
emptyObj, // max
false, // snapshot
_request->isExplain(),
- whereCallback);
+ extensionsCallback);
if (statusWithCQ.isOK()) {
_canonicalQuery = std::move(statusWithCQ.getValue());
}
diff --git a/src/mongo/db/ops/path_support_test.cpp b/src/mongo/db/ops/path_support_test.cpp
index bca8c35d604..bac517aec4b 100644
--- a/src/mongo/db/ops/path_support_test.cpp
+++ b/src/mongo/db/ops/path_support_test.cpp
@@ -490,7 +490,7 @@ TEST_F(ArrayDoc, NonNumericPathInArray) {
//
static MatchExpression* makeExpr(const BSONObj& exprBSON) {
- static const WhereCallbackNoop callbackNoop;
+ static const ExtensionsCallbackNoop callbackNoop;
return MatchExpressionParser::parse(exprBSON, callbackNoop).getValue().release();
}
diff --git a/src/mongo/db/ops/update_driver.cpp b/src/mongo/db/ops/update_driver.cpp
index 5a9dfb210da..e66264e2027 100644
--- a/src/mongo/db/ops/update_driver.cpp
+++ b/src/mongo/db/ops/update_driver.cpp
@@ -171,9 +171,9 @@ Status UpdateDriver::populateDocumentWithQueryFields(const BSONObj& query,
mutablebson::Document& doc) const {
// We canonicalize the query to collapse $and/$or, and the first arg (ns) is not needed
// Also, because this is for the upsert case, where we insert a new document if one was
- // not found, the $where clause does not make sense, hence empty WhereCallback.
+ // not found, the $where clause does not make sense, hence empty ExtensionsCallback.
auto statusWithCQ =
- CanonicalQuery::canonicalize(NamespaceString(""), query, WhereCallbackNoop());
+ CanonicalQuery::canonicalize(NamespaceString(""), query, ExtensionsCallbackNoop());
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
diff --git a/src/mongo/db/pipeline/document_source_match.cpp b/src/mongo/db/pipeline/document_source_match.cpp
index 0036eb50be9..e300114f0a7 100644
--- a/src/mongo/db/pipeline/document_source_match.cpp
+++ b/src/mongo/db/pipeline/document_source_match.cpp
@@ -96,7 +96,7 @@ bool DocumentSourceMatch::coalesce(const intrusive_ptr<DocumentSource>& nextSour
// Replace our matcher with the $and of ours and theirs.
matcher.reset(new Matcher(BSON("$and" << BSON_ARRAY(getQuery() << otherMatch->getQuery())),
- MatchExpressionParser::WhereCallback()));
+ MatchExpressionParser::ExtensionsCallback()));
return true;
}
@@ -359,6 +359,6 @@ BSONObj DocumentSourceMatch::getQuery() const {
DocumentSourceMatch::DocumentSourceMatch(const BSONObj& query,
const intrusive_ptr<ExpressionContext>& pExpCtx)
: DocumentSource(pExpCtx),
- matcher(new Matcher(query.getOwned(), MatchExpressionParser::WhereCallback())),
+ matcher(new Matcher(query.getOwned(), MatchExpressionParser::ExtensionsCallback())),
_isTextQuery(isTextQuery(query)) {}
}
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index 75ce35de32c..d6d1e0e119d 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -191,10 +191,10 @@ StatusWith<std::unique_ptr<PlanExecutor>> attemptToGetExecutor(
BSONObj projectionObj,
BSONObj sortObj,
const size_t plannerOpts) {
- const WhereCallbackReal whereCallback(pExpCtx->opCtx, pExpCtx->ns.db());
+ const ExtensionsCallbackReal extensionsCallback(pExpCtx->opCtx, pExpCtx->ns.db());
- auto cq =
- CanonicalQuery::canonicalize(pExpCtx->ns, queryObj, sortObj, projectionObj, whereCallback);
+ auto cq = CanonicalQuery::canonicalize(
+ pExpCtx->ns, queryObj, sortObj, projectionObj, extensionsCallback);
if (!cq.isOK()) {
// Return an error instead of uasserting, since there are cases where the combination of
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index 497d9151938..12fdd177746 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -104,10 +104,10 @@ bool matchExpressionLessThan(const MatchExpression* lhs, const MatchExpression*
StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
NamespaceString nss,
const BSONObj& query,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
const BSONObj emptyObj;
return CanonicalQuery::canonicalize(
- std::move(nss), query, emptyObj, emptyObj, 0, 0, whereCallback);
+ std::move(nss), query, emptyObj, emptyObj, 0, 0, extensionsCallback);
}
// static
@@ -115,7 +115,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
NamespaceString nss,
const BSONObj& query,
bool explain,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
const BSONObj emptyObj;
return CanonicalQuery::canonicalize(std::move(nss),
query,
@@ -128,7 +128,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
emptyObj, // max
false, // snapshot
explain,
- whereCallback);
+ extensionsCallback);
}
// static
@@ -137,10 +137,10 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
const BSONObj& query,
long long skip,
long long limit,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
const BSONObj emptyObj;
return CanonicalQuery::canonicalize(
- std::move(nss), query, emptyObj, emptyObj, skip, limit, whereCallback);
+ std::move(nss), query, emptyObj, emptyObj, skip, limit, extensionsCallback);
}
// static
@@ -149,8 +149,9 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
const BSONObj& query,
const BSONObj& sort,
const BSONObj& proj,
- const MatchExpressionParser::WhereCallback& whereCallback) {
- return CanonicalQuery::canonicalize(std::move(nss), query, sort, proj, 0, 0, whereCallback);
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
+ return CanonicalQuery::canonicalize(
+ std::move(nss), query, sort, proj, 0, 0, extensionsCallback);
}
// static
@@ -161,10 +162,10 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
const BSONObj& proj,
long long skip,
long long limit,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
const BSONObj emptyObj;
return CanonicalQuery::canonicalize(
- std::move(nss), query, sort, proj, skip, limit, emptyObj, whereCallback);
+ std::move(nss), query, sort, proj, skip, limit, emptyObj, extensionsCallback);
}
// static
@@ -176,7 +177,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
long long skip,
long long limit,
const BSONObj& hint,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
const BSONObj emptyObj;
return CanonicalQuery::canonicalize(std::move(nss),
query,
@@ -189,7 +190,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
emptyObj,
false, // snapshot
false, // explain
- whereCallback);
+ extensionsCallback);
}
//
@@ -198,24 +199,24 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// static
StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
- const QueryMessage& qm, const MatchExpressionParser::WhereCallback& whereCallback) {
+ const QueryMessage& qm, const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
// Make LiteParsedQuery.
auto lpqStatus = LiteParsedQuery::fromLegacyQueryMessage(qm);
if (!lpqStatus.isOK()) {
return lpqStatus.getStatus();
}
- return CanonicalQuery::canonicalize(lpqStatus.getValue().release(), whereCallback);
+ return CanonicalQuery::canonicalize(lpqStatus.getValue().release(), extensionsCallback);
}
// static
StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
- LiteParsedQuery* lpq, const MatchExpressionParser::WhereCallback& whereCallback) {
+ LiteParsedQuery* lpq, const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
std::unique_ptr<LiteParsedQuery> autoLpq(lpq);
// Make MatchExpression.
StatusWithMatchExpression statusWithMatcher =
- MatchExpressionParser::parse(autoLpq->getFilter(), whereCallback);
+ MatchExpressionParser::parse(autoLpq->getFilter(), extensionsCallback);
if (!statusWithMatcher.isOK()) {
return statusWithMatcher.getStatus();
}
@@ -224,7 +225,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// Make the CQ we'll hopefully return.
std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
- Status initStatus = cq->init(autoLpq.release(), whereCallback, me.release());
+ Status initStatus = cq->init(autoLpq.release(), extensionsCallback, me.release());
if (!initStatus.isOK()) {
return initStatus;
@@ -236,7 +237,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
const CanonicalQuery& baseQuery,
MatchExpression* root,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
// TODO: we should be passing the filter corresponding to 'root' to the LPQ rather than the base
// query's filter, baseQuery.getParsed().getFilter().
BSONObj emptyObj;
@@ -258,8 +259,8 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// Make the CQ we'll hopefully return.
std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
- Status initStatus =
- cq->init(lpqStatus.getValue().release(), whereCallback, root->shallowClone().release());
+ Status initStatus = cq->init(
+ lpqStatus.getValue().release(), extensionsCallback, root->shallowClone().release());
if (!initStatus.isOK()) {
return initStatus;
@@ -280,7 +281,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
const BSONObj& maxObj,
bool snapshot,
bool explain,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
// Pass empty sort and projection.
BSONObj emptyObj;
@@ -294,7 +295,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// Build a parse tree from the BSONObj in the parsed query.
StatusWithMatchExpression statusWithMatcher =
- MatchExpressionParser::parse(lpq->getFilter(), whereCallback);
+ MatchExpressionParser::parse(lpq->getFilter(), extensionsCallback);
if (!statusWithMatcher.isOK()) {
return statusWithMatcher.getStatus();
}
@@ -302,7 +303,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
// Make the CQ we'll hopefully return.
std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());
- Status initStatus = cq->init(lpq.release(), whereCallback, me.release());
+ Status initStatus = cq->init(lpq.release(), extensionsCallback, me.release());
if (!initStatus.isOK()) {
return initStatus;
@@ -311,7 +312,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
}
Status CanonicalQuery::init(LiteParsedQuery* lpq,
- const MatchExpressionParser::WhereCallback& whereCallback,
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback,
MatchExpression* root) {
_pq.reset(lpq);
@@ -328,7 +329,8 @@ Status CanonicalQuery::init(LiteParsedQuery* lpq,
// Validate the projection if there is one.
if (!_pq->getProj().isEmpty()) {
ParsedProjection* pp;
- Status projStatus = ParsedProjection::make(_pq->getProj(), _root.get(), &pp, whereCallback);
+ Status projStatus =
+ ParsedProjection::make(_pq->getProj(), _root.get(), &pp, extensionsCallback);
if (!projStatus.isOK()) {
return projStatus;
}
diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h
index 52d5a530aed..6025770b2b9 100644
--- a/src/mongo/db/query/canonical_query.h
+++ b/src/mongo/db/query/canonical_query.h
@@ -48,8 +48,8 @@ public:
*/
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
const QueryMessage& qm,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
/**
* Takes ownership of 'lpq'.
@@ -61,8 +61,8 @@ public:
*/
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
LiteParsedQuery* lpq,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
/**
* For testing or for internal clients to use.
@@ -78,37 +78,37 @@ public:
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
const CanonicalQuery& baseQuery,
MatchExpression* root,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
const BSONObj& query,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
const BSONObj& query,
bool explain,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
const BSONObj& query,
long long skip,
long long limit,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
const BSONObj& query,
const BSONObj& sort,
const BSONObj& proj,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
@@ -117,8 +117,8 @@ public:
const BSONObj& proj,
long long skip,
long long limit,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
@@ -128,8 +128,8 @@ public:
long long skip,
long long limit,
const BSONObj& hint,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
static StatusWith<std::unique_ptr<CanonicalQuery>> canonicalize(
NamespaceString nss,
@@ -143,8 +143,8 @@ public:
const BSONObj& maxObj,
bool snapshot,
bool explain,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
/**
* Returns true if "query" describes an exact-match query on _id, possibly with
@@ -216,7 +216,7 @@ private:
* Takes ownership of 'root' and 'lpq'.
*/
Status init(LiteParsedQuery* lpq,
- const MatchExpressionParser::WhereCallback& whereCallback,
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback,
MatchExpression* root);
std::unique_ptr<LiteParsedQuery> _pq;
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 62da32cacf2..b001bc38dc2 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -492,7 +492,7 @@ std::string runQuery(OperationContext* txn,
// Parse the qm into a CanonicalQuery.
- auto statusWithCQ = CanonicalQuery::canonicalize(q, WhereCallbackReal(txn, nss.db()));
+ auto statusWithCQ = CanonicalQuery::canonicalize(q, ExtensionsCallbackReal(txn, nss.db()));
if (!statusWithCQ.isOK()) {
uasserted(
17287,
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 7715434ab5d..c379c5fa2cb 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -265,7 +265,7 @@ Status prepareExecution(OperationContext* opCtx,
// document, so we don't support covered projections. However, we might use the
// simple inclusion fast path.
if (NULL != canonicalQuery->getProj()) {
- ProjectionStageParams params(WhereCallbackReal(opCtx, collection->ns().db()));
+ ProjectionStageParams params(ExtensionsCallbackReal(opCtx, collection->ns().db()));
params.projObj = canonicalQuery->getProj()->getProjObj();
// Add a SortKeyGeneratorStage if there is a $meta sortKey projection.
@@ -614,7 +614,7 @@ StatusWith<unique_ptr<PlanStage>> applyProjection(OperationContext* txn,
"Cannot use a $meta sortKey projection in findAndModify commands."};
}
- ProjectionStageParams params(WhereCallbackReal(txn, nsString.db()));
+ ProjectionStageParams params(ExtensionsCallbackReal(txn, nsString.db()));
params.projObj = proj;
params.fullExpression = cq->root();
return {make_unique<ProjectionStage>(txn, params, ws, root.release())};
@@ -921,10 +921,10 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorGroup(OperationContext* txn,
}
const NamespaceString nss(request.ns);
- const WhereCallbackReal whereCallback(txn, nss.db());
+ const ExtensionsCallbackReal extensionsCallback(txn, nss.db());
auto statusWithCQ =
- CanonicalQuery::canonicalize(nss, request.query, request.explain, whereCallback);
+ CanonicalQuery::canonicalize(nss, request.query, request.explain, extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
@@ -1157,7 +1157,7 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorCount(OperationContext* txn,
unique_ptr<CanonicalQuery> cq;
if (!request.getQuery().isEmpty() || !request.getHint().isEmpty()) {
// If query or hint is not empty, canonicalize the query before working with collection.
- typedef MatchExpressionParser::WhereCallback WhereCallback;
+ typedef MatchExpressionParser::ExtensionsCallback ExtensionsCallback;
auto statusWithCQ = CanonicalQuery::canonicalize(
request.getNs(),
request.getQuery(),
@@ -1170,9 +1170,9 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorCount(OperationContext* txn,
BSONObj(), // max
false, // snapshot
explain,
- collection
- ? static_cast<const WhereCallback&>(WhereCallbackReal(txn, collection->ns().db()))
- : static_cast<const WhereCallback&>(WhereCallbackNoop()));
+ collection ? static_cast<const ExtensionsCallback&>(
+ ExtensionsCallbackReal(txn, collection->ns().db()))
+ : static_cast<const ExtensionsCallback&>(ExtensionsCallbackNoop()));
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
@@ -1313,13 +1313,13 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorDistinct(OperationContext* txn,
}
}
- const WhereCallbackReal whereCallback(txn, collection->ns().db());
+ const ExtensionsCallbackReal extensionsCallback(txn, collection->ns().db());
// If there are no suitable indices for the distinct hack bail out now into regular planning
// with no projection.
if (plannerParams.indices.empty()) {
auto statusWithCQ =
- CanonicalQuery::canonicalize(collection->ns(), query, isExplain, whereCallback);
+ CanonicalQuery::canonicalize(collection->ns(), query, isExplain, extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
@@ -1348,7 +1348,7 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorDistinct(OperationContext* txn,
BSONObj(), // max
false, // snapshot
isExplain,
- whereCallback);
+ extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
@@ -1434,7 +1434,8 @@ StatusWith<unique_ptr<PlanExecutor>> getExecutorDistinct(OperationContext* txn,
}
// We drop the projection from the 'cq'. Unfortunately this is not trivial.
- statusWithCQ = CanonicalQuery::canonicalize(collection->ns(), query, isExplain, whereCallback);
+ statusWithCQ =
+ CanonicalQuery::canonicalize(collection->ns(), query, isExplain, extensionsCallback);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
diff --git a/src/mongo/db/query/parsed_projection.cpp b/src/mongo/db/query/parsed_projection.cpp
index 92c33bb14db..b6e086be320 100644
--- a/src/mongo/db/query/parsed_projection.cpp
+++ b/src/mongo/db/query/parsed_projection.cpp
@@ -48,7 +48,7 @@ using std::string;
Status ParsedProjection::make(const BSONObj& spec,
const MatchExpression* const query,
ParsedProjection** out,
- const MatchExpressionParser::WhereCallback& whereCallback) {
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback) {
// Whether we're including or excluding fields.
enum class IncludeExclude { kUninitialized, kInclude, kExclude };
IncludeExclude includeExclude = IncludeExclude::kUninitialized;
@@ -125,7 +125,7 @@ Status ParsedProjection::make(const BSONObj& spec,
// TODO: Is there a faster way of validating the elemMatchObj?
StatusWithMatchExpression statusWithMatcher =
- MatchExpressionParser::parse(elemMatchObj, whereCallback);
+ MatchExpressionParser::parse(elemMatchObj, extensionsCallback);
if (!statusWithMatcher.isOK()) {
return statusWithMatcher.getStatus();
}
diff --git a/src/mongo/db/query/parsed_projection.h b/src/mongo/db/query/parsed_projection.h
index 8c76944b796..2726e043ac3 100644
--- a/src/mongo/db/query/parsed_projection.h
+++ b/src/mongo/db/query/parsed_projection.h
@@ -48,8 +48,8 @@ public:
static Status make(const BSONObj& spec,
const MatchExpression* const query,
ParsedProjection** out,
- const MatchExpressionParser::WhereCallback& whereCallback =
- MatchExpressionParser::WhereCallback());
+ const MatchExpressionParser::ExtensionsCallback& extensionsCallback =
+ MatchExpressionParser::ExtensionsCallback());
/**
* Returns true if the projection requires match details from the query,
diff --git a/src/mongo/db/query/query_planner_test_fixture.cpp b/src/mongo/db/query/query_planner_test_fixture.cpp
index 9e8446f5fcc..3042665fadd 100644
--- a/src/mongo/db/query/query_planner_test_fixture.cpp
+++ b/src/mongo/db/query/query_planner_test_fixture.cpp
@@ -256,8 +256,8 @@ void QueryPlannerTest::runQueryAsCommand(const BSONObj& cmdObj) {
std::unique_ptr<LiteParsedQuery> lpq(
assertGet(LiteParsedQuery::makeFromFindCommand(nss, cmdObj, isExplain)));
- WhereCallbackNoop whereCallback;
- auto statusWithCQ = CanonicalQuery::canonicalize(lpq.release(), whereCallback);
+ ExtensionsCallbackNoop extensionsCallback;
+ auto statusWithCQ = CanonicalQuery::canonicalize(lpq.release(), extensionsCallback);
ASSERT_OK(statusWithCQ.getStatus());
Status s = QueryPlanner::plan(*statusWithCQ.getValue(), params, &solns.mutableVector());
diff --git a/src/mongo/db/query/stage_builder.cpp b/src/mongo/db/query/stage_builder.cpp
index b971c44288a..2495f8e4cdb 100644
--- a/src/mongo/db/query/stage_builder.cpp
+++ b/src/mongo/db/query/stage_builder.cpp
@@ -133,7 +133,7 @@ PlanStage* buildStages(OperationContext* txn,
return NULL;
}
- ProjectionStageParams params(WhereCallbackReal(txn, collection->ns().db()));
+ ProjectionStageParams params(ExtensionsCallbackReal(txn, collection->ns().db()));
params.projObj = pn->projection;
// Stuff the right data into the params depending on what proj impl we use.
diff --git a/src/mongo/dbtests/matchertests.cpp b/src/mongo/dbtests/matchertests.cpp
index 17e00d3f1ec..2b186432741 100644
--- a/src/mongo/dbtests/matchertests.cpp
+++ b/src/mongo/dbtests/matchertests.cpp
@@ -56,7 +56,7 @@ class Basic {
public:
void run() {
BSONObj query = fromjson("{\"a\":\"b\"}");
- M m(query, MatchExpressionParser::WhereCallback());
+ M m(query, MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(fromjson("{\"a\":\"b\"}")));
}
};
@@ -66,7 +66,7 @@ class DoubleEqual {
public:
void run() {
BSONObj query = fromjson("{\"a\":5}");
- M m(query, MatchExpressionParser::WhereCallback());
+ M m(query, MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(fromjson("{\"a\":5}")));
}
};
@@ -77,7 +77,7 @@ public:
void run() {
BSONObjBuilder query;
query.append("a", 5);
- M m(query.done(), MatchExpressionParser::WhereCallback());
+ M m(query.done(), MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(fromjson("{\"a\":5}")));
}
};
@@ -87,7 +87,7 @@ class MixedNumericGt {
public:
void run() {
BSONObj query = fromjson("{\"a\":{\"$gt\":4}}");
- M m(query, MatchExpressionParser::WhereCallback());
+ M m(query, MatchExpressionParser::ExtensionsCallback());
BSONObjBuilder b;
b.append("a", 5);
ASSERT(m.matches(b.done()));
@@ -102,7 +102,7 @@ public:
ASSERT_EQUALS(4, query["a"].embeddedObject()["$in"].embeddedObject()["0"].number());
ASSERT_EQUALS(NumberInt, query["a"].embeddedObject()["$in"].embeddedObject()["0"].type());
- M m(query, MatchExpressionParser::WhereCallback());
+ M m(query, MatchExpressionParser::ExtensionsCallback());
{
BSONObjBuilder b;
@@ -129,7 +129,7 @@ template <typename M>
class MixedNumericEmbedded {
public:
void run() {
- M m(BSON("a" << BSON("x" << 1)), MatchExpressionParser::WhereCallback());
+ M m(BSON("a" << BSON("x" << 1)), MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(BSON("a" << BSON("x" << 1))));
ASSERT(m.matches(BSON("a" << BSON("x" << 1.0))));
}
@@ -139,7 +139,7 @@ template <typename M>
class Size {
public:
void run() {
- M m(fromjson("{a:{$size:4}}"), MatchExpressionParser::WhereCallback());
+ M m(fromjson("{a:{$size:4}}"), MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(fromjson("{a:[1,2,3,4]}")));
ASSERT(!m.matches(fromjson("{a:[1,2,3]}")));
ASSERT(!m.matches(fromjson("{a:[1,2,3,'a','b']}")));
@@ -152,7 +152,7 @@ class WithinBox {
public:
void run() {
M m(fromjson("{loc:{$within:{$box:[{x: 4, y:4},[6,6]]}}}"),
- MatchExpressionParser::WhereCallback());
+ MatchExpressionParser::ExtensionsCallback());
ASSERT(!m.matches(fromjson("{loc: [3,4]}")));
ASSERT(m.matches(fromjson("{loc: [4,4]}")));
ASSERT(m.matches(fromjson("{loc: [5,5]}")));
@@ -166,7 +166,7 @@ class WithinPolygon {
public:
void run() {
M m(fromjson("{loc:{$within:{$polygon:[{x:0,y:0},[0,5],[5,5],[5,0]]}}}"),
- MatchExpressionParser::WhereCallback());
+ MatchExpressionParser::ExtensionsCallback());
ASSERT(m.matches(fromjson("{loc: [3,4]}")));
ASSERT(m.matches(fromjson("{loc: [4,4]}")));
ASSERT(m.matches(fromjson("{loc: {x:5,y:5}}")));
@@ -180,7 +180,7 @@ class WithinCenter {
public:
void run() {
M m(fromjson("{loc:{$within:{$center:[{x:30,y:30},10]}}}"),
- MatchExpressionParser::WhereCallback());
+ MatchExpressionParser::ExtensionsCallback());
ASSERT(!m.matches(fromjson("{loc: [3,4]}")));
ASSERT(m.matches(fromjson("{loc: {x:30,y:30}}")));
ASSERT(m.matches(fromjson("{loc: [20,30]}")));
@@ -196,7 +196,7 @@ template <typename M>
class ElemMatchKey {
public:
void run() {
- M matcher(BSON("a.b" << 1), MatchExpressionParser::WhereCallback());
+ M matcher(BSON("a.b" << 1), MatchExpressionParser::ExtensionsCallback());
MatchDetails details;
details.requestElemMatchKey();
ASSERT(!details.hasElemMatchKey());
@@ -216,7 +216,7 @@ public:
M m(BSON("$where"
<< "function(){ return this.a == 1; }"),
- WhereCallbackReal(&txn, StringData("unittests")));
+ ExtensionsCallbackReal(&txn, StringData("unittests")));
ASSERT(m.matches(BSON("a" << 1)));
ASSERT(!m.matches(BSON("a" << 2)));
}
@@ -226,7 +226,7 @@ template <typename M>
class TimingBase {
public:
long dotime(const BSONObj& patt, const BSONObj& obj) {
- M m(patt, MatchExpressionParser::WhereCallback());
+ M m(patt, MatchExpressionParser::ExtensionsCallback());
Timer t;
for (int i = 0; i < 900000; i++) {
if (!m.matches(obj)) {
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp
index f8e267f18ad..cd5bd4e223d 100644
--- a/src/mongo/s/chunk_manager.cpp
+++ b/src/mongo/s/chunk_manager.cpp
@@ -477,7 +477,7 @@ ChunkPtr ChunkManager::findIntersectingChunk(OperationContext* txn, const BSONOb
void ChunkManager::getShardIdsForQuery(set<ShardId>& shardIds, const BSONObj& query) const {
auto statusWithCQ =
- CanonicalQuery::canonicalize(NamespaceString(_ns), query, WhereCallbackNoop());
+ CanonicalQuery::canonicalize(NamespaceString(_ns), query, ExtensionsCallbackNoop());
uassertStatusOK(statusWithCQ.getStatus());
unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
diff --git a/src/mongo/s/chunk_manager_targeter_test.cpp b/src/mongo/s/chunk_manager_targeter_test.cpp
index 8a8a629102b..c7e870c5391 100644
--- a/src/mongo/s/chunk_manager_targeter_test.cpp
+++ b/src/mongo/s/chunk_manager_targeter_test.cpp
@@ -56,7 +56,7 @@ using std::make_pair;
unique_ptr<CanonicalQuery> canonicalize(const char* queryStr) {
BSONObj queryObj = fromjson(queryStr);
const NamespaceString nss("test.foo");
- auto statusWithCQ = CanonicalQuery::canonicalize(nss, queryObj, WhereCallbackNoop());
+ auto statusWithCQ = CanonicalQuery::canonicalize(nss, queryObj, ExtensionsCallbackNoop());
ASSERT_OK(statusWithCQ.getStatus());
return std::move(statusWithCQ.getValue());
}
diff --git a/src/mongo/s/commands/cluster_find_cmd.cpp b/src/mongo/s/commands/cluster_find_cmd.cpp
index 445e0870bfe..d2ae3ef6080 100644
--- a/src/mongo/s/commands/cluster_find_cmd.cpp
+++ b/src/mongo/s/commands/cluster_find_cmd.cpp
@@ -142,7 +142,7 @@ public:
return appendCommandStatus(result, lpq.getStatus());
}
- auto cq = CanonicalQuery::canonicalize(lpq.getValue().release(), WhereCallbackNoop());
+ auto cq = CanonicalQuery::canonicalize(lpq.getValue().release(), ExtensionsCallbackNoop());
if (!cq.isOK()) {
return appendCommandStatus(result, cq.getStatus());
}
diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp
index 48b3eb13268..ae7f569c845 100644
--- a/src/mongo/s/shard_key_pattern.cpp
+++ b/src/mongo/s/shard_key_pattern.cpp
@@ -266,7 +266,7 @@ StatusWith<BSONObj> ShardKeyPattern::extractShardKeyFromQuery(const BSONObj& bas
// Extract equalities from query
auto statusWithCQ =
- CanonicalQuery::canonicalize(NamespaceString(""), basicQuery, WhereCallbackNoop());
+ CanonicalQuery::canonicalize(NamespaceString(""), basicQuery, ExtensionsCallbackNoop());
if (!statusWithCQ.isOK()) {
return StatusWith<BSONObj>(statusWithCQ.getStatus());
}
diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp
index 79f63fc463b..911c23971ea 100644
--- a/src/mongo/s/strategy.cpp
+++ b/src/mongo/s/strategy.cpp
@@ -197,7 +197,7 @@ void Strategy::queryOp(OperationContext* txn, Request& request) {
uassertStatusOK(readPrefExtractStatus);
}
- auto canonicalQuery = CanonicalQuery::canonicalize(q, WhereCallbackNoop());
+ auto canonicalQuery = CanonicalQuery::canonicalize(q, ExtensionsCallbackNoop());
uassertStatusOK(canonicalQuery.getStatus());
// If the $explain flag was set, we must run the operation on the shards as an explain