summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/index_filter_commands_test.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-12-14 18:22:01 -0500
committerDavid Storch <david.storch@10gen.com>2015-12-22 10:13:40 -0500
commit26bcf4ddd7e86885448e981f86aaf51fba0e2539 (patch)
tree5d9cd1de1193f8c52f8d1eae3dd3e35a3bffd3f0 /src/mongo/db/commands/index_filter_commands_test.cpp
parent3663e004dfc2f73b82b3d88b5fa1ac6b7dcd1d33 (diff)
downloadmongo-26bcf4ddd7e86885448e981f86aaf51fba0e2539.tar.gz
SERVER-21407 explicitly disallow $text/$where extensions during MatchExpression parsing
Diffstat (limited to 'src/mongo/db/commands/index_filter_commands_test.cpp')
-rw-r--r--src/mongo/db/commands/index_filter_commands_test.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp
index 5a0d7b6ce07..463f1bb117e 100644
--- a/src/mongo/db/commands/index_filter_commands_test.cpp
+++ b/src/mongo/db/commands/index_filter_commands_test.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/json.h"
+#include "mongo/db/matcher/extensions_callback_disallow_extensions.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/query/plan_ranker.h"
#include "mongo/db/query/query_solution.h"
@@ -120,7 +121,8 @@ void addQueryShapeToPlanCache(PlanCache* planCache,
BSONObj projectionObj = fromjson(projectionStr);
// Create canonical query.
- auto statusWithCQ = CanonicalQuery::canonicalize(nss, queryObj, sortObj, projectionObj);
+ auto statusWithCQ = CanonicalQuery::canonicalize(
+ nss, queryObj, sortObj, projectionObj, ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCQ.getStatus());
std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
@@ -144,7 +146,8 @@ bool planCacheContains(const PlanCache& planCache,
BSONObj projectionObj = fromjson(projectionStr);
// Create canonical query.
- auto statusWithInputQuery = CanonicalQuery::canonicalize(nss, queryObj, sortObj, projectionObj);
+ auto statusWithInputQuery = CanonicalQuery::canonicalize(
+ nss, queryObj, sortObj, projectionObj, ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithInputQuery.getStatus());
unique_ptr<CanonicalQuery> inputQuery = std::move(statusWithInputQuery.getValue());
@@ -160,7 +163,11 @@ bool planCacheContains(const PlanCache& planCache,
// Alternatively, we could add key to PlanCacheEntry but that would be used in one place
// only.
auto statusWithCurrentQuery =
- CanonicalQuery::canonicalize(nss, entry->query, entry->sort, entry->projection);
+ CanonicalQuery::canonicalize(nss,
+ entry->query,
+ entry->sort,
+ entry->projection,
+ ExtensionsCallbackDisallowExtensions());
ASSERT_OK(statusWithCurrentQuery.getStatus());
unique_ptr<CanonicalQuery> currentQuery = std::move(statusWithCurrentQuery.getValue());