summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp')
-rw-r--r--src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp
index 0f6dc702287..87c1d847beb 100644
--- a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp
+++ b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index_test.cpp
@@ -31,7 +31,6 @@
#include "mongo/bson/json.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/matcher/expression_with_placeholder.h"
-#include "mongo/db/matcher/extensions_callback_disallow_extensions.h"
#include "mongo/db/matcher/schema/expression_internal_schema_match_array_index.h"
#include "mongo/db/query/collation/collator_interface_mock.h"
#include "mongo/unittest/unittest.h"
@@ -44,8 +43,7 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, RejectsNonArrays) {
auto filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 0, namePlaceholder: 'i', expression: {i: {$gt: 7}}}}}");
- auto expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ auto expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_FALSE(expr.getValue()->matchesBSON(fromjson("{foo: 'blah'}")));
ASSERT_FALSE(expr.getValue()->matchesBSON(fromjson("{foo: 7}")));
@@ -56,8 +54,7 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, MatchesArraysWithMatchingElem
auto filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 0, namePlaceholder: 'i', expression: {i: {$elemMatch: {'bar': 7}}}}}}");
- auto expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ auto expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{foo: [[{bar: 7}], [{bar: 5}]]}")));
ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{foo: [[{bar: [3, 5, 7]}], [{bar: 5}]]}")));
@@ -65,8 +62,7 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, MatchesArraysWithMatchingElem
filter = fromjson(
"{baz: {$_internalSchemaMatchArrayIndex:"
"{index: 2, namePlaceholder: 'i', expression: {i: {$type: 'string'}}}}}");
- expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{baz: [0, 1, '2']}")));
}
@@ -75,16 +71,14 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, DoesNotMatchArrayIfMatchingEl
auto filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 0, namePlaceholder: 'i', expression: {i: {$lte: 7}}}}}");
- auto expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ auto expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_FALSE(expr.getValue()->matchesBSON(fromjson("{foo: [33, 0, 1, 2]}")));
filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 1, namePlaceholder: 'i', expression: {i: {$lte: 7}}}}}");
- expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_FALSE(expr.getValue()->matchesBSON(fromjson("{foo: [0, 99, 1, 2]}")));
}
@@ -93,16 +87,14 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, MatchesIfNotEnoughArrayElemen
auto filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 0, namePlaceholder: 'i', expression: {i: 1}}}}");
- auto expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ auto expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{foo: []}")));
filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 4, namePlaceholder: 'i', expression: {i: 1}}}}");
- expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
ASSERT_TRUE(expr.getValue()->matchesBSON(fromjson("{foo: ['no', 'no', 'no', 'no']}")));
}
@@ -111,8 +103,7 @@ TEST(InternalSchemaMatchArrayIndexMatchExpression, EquivalentToClone) {
auto filter = fromjson(
"{foo: {$_internalSchemaMatchArrayIndex:"
"{index: 0, namePlaceholder: 'i', expression: {i: {$type: 'number'}}}}}");
- auto expr = MatchExpressionParser::parse(
- filter, ExtensionsCallbackDisallowExtensions(), kSimpleCollator);
+ auto expr = MatchExpressionParser::parse(filter, kSimpleCollator);
ASSERT_OK(expr.getStatus());
auto clone = expr.getValue()->shallowClone();
ASSERT_TRUE(expr.getValue()->equivalent(clone.get()));