summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/projection_ast_test.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/query/projection_ast_test.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
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