summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/projection_ast_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/projection_ast_test.cpp')
-rw-r--r--src/mongo/db/query/projection_ast_test.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/mongo/db/query/projection_ast_test.cpp b/src/mongo/db/query/projection_ast_test.cpp
index ea1eb2b683d..619bd9a1dde 100644
--- a/src/mongo/db/query/projection_ast_test.cpp
+++ b/src/mongo/db/query/projection_ast_test.cpp
@@ -41,7 +41,6 @@
#include "mongo/db/query/projection_ast_util.h"
#include "mongo/db/query/projection_parser.h"
#include "mongo/db/query/query_planner_test_fixture.h"
-#include "mongo/db/query/query_shape/serialization_options.h"
namespace {
@@ -773,62 +772,4 @@ TEST_F(ProjectionASTTest, ShouldThrowWithPositionalOnExclusion) {
DBException,
31395);
}
-
-TEST_F(ProjectionASTTest, TestASTRedaction) {
- SerializationOptions options = SerializationOptions::kDebugShapeAndMarkIdentifiers_FOR_TEST;
-
- auto proj = fromjson("{'a.b': 1}");
- BSONObj output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<a>":{"HASH<b>":true},"HASH<_id>":true})",
- output);
-
- proj = fromjson("{'a.b': 0}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<a>":{"HASH<b>":false}})",
- output);
-
- proj = fromjson("{a: 1, b: 1}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<a>":true,"HASH<b>":true,"HASH<_id>":true})",
- output);
-
- // ElemMatch projection
- proj = fromjson("{f: {$elemMatch: {foo: 'bar'}}}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<f>":{"$elemMatch":{"HASH<foo>":{"$eq":"?string"}}},"HASH<_id>":true})",
- output);
-
- // Positional projection
- proj = fromjson("{'x.$': 1}");
- output = projection_ast::serialize(
- *parseWithFindFeaturesEnabled(proj, fromjson("{'x.a': 2}")).root(), {});
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"x.$":true,"_id":true})",
- output);
-
- // Slice (first form)
- proj = fromjson("{a: {$slice: 1}}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<a>":{"$slice":"?number"}})",
- output);
-
- // Slice (second form)
- proj = fromjson("{a: {$slice: [1, 3]}}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<a>":{"$slice":["?number","?number"]}})",
- output);
-
- /// $meta projection
- proj = fromjson("{foo: {$meta: 'indexKey'}}");
- output = projection_ast::serialize(*parseWithFindFeaturesEnabled(proj).root(), options);
- ASSERT_BSONOBJ_EQ_AUTO( //
- R"({"HASH<foo>":{"$meta":"indexKey"}})",
- output);
-}
} // namespace