diff options
author | Alexander Ignatyev <alexander.ignatyev@mongodb.com> | 2022-04-26 18:01:18 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-04 17:24:34 +0000 |
commit | 3c0df34e8a6a4c8f68428c2fbfb965f0b2e42e64 (patch) | |
tree | 69a4f0a3f5dd657cbb5a089015610a4dff1c99ab /src/mongo/db/query/canonical_query_test.cpp | |
parent | b8cde770ab6e244bf22238a8eb822326dfbac6ce (diff) | |
download | mongo-3c0df34e8a6a4c8f68428c2fbfb965f0b2e42e64.tar.gz |
SERVER-65793 Do not parameterize queries with TEXT match expression node
(cherry picked from commit 9ca1d39e1ad5317bf3e8dcbef937f165f991d74c)
Diffstat (limited to 'src/mongo/db/query/canonical_query_test.cpp')
-rw-r--r-- | src/mongo/db/query/canonical_query_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/query/canonical_query_test.cpp b/src/mongo/db/query/canonical_query_test.cpp index 3d5f27431a9..dbb2fd929da 100644 --- a/src/mongo/db/query/canonical_query_test.cpp +++ b/src/mongo/db/query/canonical_query_test.cpp @@ -34,6 +34,7 @@ #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/query_test_service_context.h" +#include "mongo/idl/server_parameter_test_util.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -454,5 +455,18 @@ TEST(CanonicalQueryTest, InvalidSortOrdersFailToCanonicalize) { assertInvalidSortOrder(fromjson("{'': -1}")); } +TEST(CanonicalQueryTest, DoNotParameterizeTextExpressions) { + RAIIServerParameterControllerForTest controllerSBEPlanCache("featureFlagSbePlanCache", true); + auto cq = + canonicalize("{$text: {$search: \"Hello World!\"}}", + MatchExpressionParser::kDefaultSpecialFeatures | MatchExpressionParser::kText); + ASSERT_FALSE(cq->isParameterized()); +} + +TEST(CanonicalQueryTest, DoParameterizeRegularExpressions) { + RAIIServerParameterControllerForTest controllerSBEPlanCache("featureFlagSbePlanCache", true); + auto cq = canonicalize("{a: 1, b: {$lt: 5}}"); + ASSERT_TRUE(cq->isParameterized()); +} } // namespace } // namespace mongo |