diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index b6036db8e5..ba0e64bd02 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -1205,8 +1205,8 @@ env.Library(
         'ops/delete_request.idl',
         'ops/parsed_delete.cpp',
         'ops/update_result.cpp',
-        'pipeline/document_source_cursor.cpp',
-        'pipeline/document_source_geo_near_cursor.cpp',
+        'pipeline/document_source/document_source_cursor.cpp',
+        'pipeline/document_source/document_source_geo_near_cursor.cpp',
         'pipeline/pipeline_d.cpp',
         'pipeline/plan_executor_pipeline.cpp',
         'pipeline/plan_explainer_pipeline.cpp',
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index a8831db8fe..6d7bc60414 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -74,7 +74,7 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/op_observer.h"
 #include "mongo/db/ops/insert.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/pipeline/storage_stats_spec_gen.h"
 #include "mongo/db/query/collation/collator_factory_interface.h"
 #include "mongo/db/query/get_executor.h"
diff --git a/src/mongo/db/commands/map_reduce_agg.cpp b/src/mongo/db/commands/map_reduce_agg.cpp
index 43a66fb231..1602660b68 100644
--- a/src/mongo/db/commands/map_reduce_agg.cpp
+++ b/src/mongo/db/commands/map_reduce_agg.cpp
@@ -46,8 +46,8 @@
 #include "mongo/db/db_raii.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/pipeline_d.h"
 #include "mongo/db/pipeline/plan_executor_pipeline.h"
 #include "mongo/db/query/explain_common.h"
diff --git a/src/mongo/db/commands/map_reduce_agg_test.cpp b/src/mongo/db/commands/map_reduce_agg_test.cpp
index 52ee67c416..7bc635eb13 100644
--- a/src/mongo/db/commands/map_reduce_agg_test.cpp
+++ b/src/mongo/db/commands/map_reduce_agg_test.cpp
@@ -36,13 +36,13 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/commands/map_reduce_agg.h"
 #include "mongo/db/commands/mr_common.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/commands/mr_common.cpp b/src/mongo/db/commands/mr_common.cpp
index 46a0a0e628..cbdb6be485 100644
--- a/src/mongo/db/commands/mr_common.cpp
+++ b/src/mongo/db/commands/mr_common.cpp
@@ -40,18 +40,18 @@
 #include "mongo/db/exec/inclusion_projection_executor.h"
 #include "mongo/db/exec/projection_node.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/accumulator_js_reduce.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
-#include "mongo/db/pipeline/expression_function.h"
-#include "mongo/db/pipeline/expression_js_emit.h"
+#include "mongo/db/pipeline/accumulator/accumulator_js_reduce.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
+#include "mongo/db/pipeline/expression/expression_function.h"
+#include "mongo/db/pipeline/expression/expression_js_emit.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/util/intrusive_counter.h"
 #include "mongo/util/str.h"
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 0c7b25d852..8b7d0732d9 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -47,13 +47,13 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/working_set_common.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
 #include "mongo/db/pipeline/change_stream_invalidation_info.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_exchange.h"
-#include "mongo/db/pipeline/document_source_geo_near.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_exchange.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/pipeline_d.h"
diff --git a/src/mongo/db/cst/cst_literals_test.cpp b/src/mongo/db/cst/cst_literals_test.cpp
index 938d8226e8..0ac4590e38 100644
--- a/src/mongo/db/cst/cst_literals_test.cpp
+++ b/src/mongo/db/cst/cst_literals_test.cpp
@@ -40,9 +40,9 @@
 #include "mongo/db/cst/key_value.h"
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/cst/cst_pipeline_translation.cpp b/src/mongo/db/cst/cst_pipeline_translation.cpp
index f94929e193..98a81224e5 100644
--- a/src/mongo/db/cst/cst_pipeline_translation.cpp
+++ b/src/mongo/db/cst/cst_pipeline_translation.cpp
@@ -48,15 +48,15 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/exec/exclusion_projection_executor.h"
 #include "mongo/db/exec/inclusion_projection_executor.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_skip.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
+#include "mongo/db/pipeline/expression/expression.h"
+#include "mongo/db/pipeline/expression/expression_trigonometric.h"
 #include "mongo/db/pipeline/expression_context.h"
-#include "mongo/db/pipeline/expression_trigonometric.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/variable_validation.h"
 #include "mongo/db/pipeline/variables.h"
diff --git a/src/mongo/db/cst/cst_pipeline_translation_test.cpp b/src/mongo/db/cst/cst_pipeline_translation_test.cpp
index 3d247af1e5..aadb5ceada 100644
--- a/src/mongo/db/cst/cst_pipeline_translation_test.cpp
+++ b/src/mongo/db/cst/cst_pipeline_translation_test.cpp
@@ -43,11 +43,11 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/variables.h"
 #include "mongo/db/query/util/make_data_structure.h"
diff --git a/src/mongo/db/cst/cst_sort_translation.cpp b/src/mongo/db/cst/cst_sort_translation.cpp
index b2f85d7164..bd4afe4d73 100644
--- a/src/mongo/db/cst/cst_sort_translation.cpp
+++ b/src/mongo/db/cst/cst_sort_translation.cpp
@@ -35,7 +35,7 @@
 #include "mongo/db/cst/key_value.h"
 #include "mongo/db/cst/path.h"
 #include "mongo/db/exec/document_value/document_metadata_fields.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/util/visit_helper.h"
 
diff --git a/src/mongo/db/exec/add_fields_projection_executor.h b/src/mongo/db/exec/add_fields_projection_executor.h
index 39fe73946a..6882bbb6f6 100644
--- a/src/mongo/db/exec/add_fields_projection_executor.h
+++ b/src/mongo/db/exec/add_fields_projection_executor.h
@@ -32,7 +32,7 @@
 #include <memory>
 
 #include "mongo/db/exec/inclusion_projection_executor.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 
 namespace mongo::projection_executor {
diff --git a/src/mongo/db/exec/find_projection_executor_test.cpp b/src/mongo/db/exec/find_projection_executor_test.cpp
index 0940ef96be..789e5d1c3c 100644
--- a/src/mongo/db/exec/find_projection_executor_test.cpp
+++ b/src/mongo/db/exec/find_projection_executor_test.cpp
@@ -33,7 +33,7 @@
 #include "mongo/db/exec/projection_executor.h"
 #include "mongo/db/exec/projection_executor_builder.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/expression_find_internal.h"
+#include "mongo/db/pipeline/expression/expression_find_internal.h"
 #include "mongo/db/query/projection_parser.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/exec/inclusion_projection_executor.h b/src/mongo/db/exec/inclusion_projection_executor.h
index a0429ff924..17e62ecc8b 100644
--- a/src/mongo/db/exec/inclusion_projection_executor.h
+++ b/src/mongo/db/exec/inclusion_projection_executor.h
@@ -33,7 +33,7 @@
 
 #include "mongo/db/exec/projection_executor.h"
 #include "mongo/db/exec/projection_node.h"
-#include "mongo/db/pipeline/expression_walker.h"
+#include "mongo/db/pipeline/expression/expression_walker.h"
 
 namespace mongo::projection_executor {
 /**
diff --git a/src/mongo/db/exec/projection_executor_builder.cpp b/src/mongo/db/exec/projection_executor_builder.cpp
index 1b712685ea..faf2446d2e 100644
--- a/src/mongo/db/exec/projection_executor_builder.cpp
+++ b/src/mongo/db/exec/projection_executor_builder.cpp
@@ -34,7 +34,7 @@
 #include "mongo/base/exact_cast.h"
 #include "mongo/db/exec/exclusion_projection_executor.h"
 #include "mongo/db/exec/inclusion_projection_executor.h"
-#include "mongo/db/pipeline/expression_find_internal.h"
+#include "mongo/db/pipeline/expression/expression_find_internal.h"
 #include "mongo/db/query/projection_ast_path_tracking_visitor.h"
 #include "mongo/db/query/tree_walker.h"
 #include "mongo/db/query/util/make_data_structure.h"
diff --git a/src/mongo/db/exec/sort_executor.h b/src/mongo/db/exec/sort_executor.h
index 357d01fd2a..602cc30444 100644
--- a/src/mongo/db/exec/sort_executor.h
+++ b/src/mongo/db/exec/sort_executor.h
@@ -33,7 +33,7 @@
 #include "mongo/db/exec/plan_stats.h"
 #include "mongo/db/exec/sort_key_comparator.h"
 #include "mongo/db/exec/working_set.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/query/sort_pattern.h"
 #include "mongo/db/sorter/sorter.h"
 
diff --git a/src/mongo/db/matcher/expression_expr.h b/src/mongo/db/matcher/expression_expr.h
index 4e9e6dc29a..97f6116a9e 100644
--- a/src/mongo/db/matcher/expression_expr.h
+++ b/src/mongo/db/matcher/expression_expr.h
@@ -35,9 +35,9 @@
 #include "mongo/db/matcher/expression.h"
 #include "mongo/db/matcher/expression_tree.h"
 #include "mongo/db/matcher/rewrite_expr.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
+#include "mongo/db/pipeline/expression/expression_walker.h"
 #include "mongo/db/pipeline/expression_context.h"
-#include "mongo/db/pipeline/expression_walker.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/matcher/expression_optimize_test.cpp b/src/mongo/db/matcher/expression_optimize_test.cpp
index eaa606e06d..7fdd307ce5 100644
--- a/src/mongo/db/matcher/expression_optimize_test.cpp
+++ b/src/mongo/db/matcher/expression_optimize_test.cpp
@@ -27,7 +27,7 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 #include <vector>
 
diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h
index 101a7e1033..b9c9baeafc 100644
--- a/src/mongo/db/matcher/expression_parser.h
+++ b/src/mongo/db/matcher/expression_parser.h
@@ -41,7 +41,7 @@
 #include "mongo/db/matcher/extensions_callback.h"
 #include "mongo/db/matcher/extensions_callback_noop.h"
 #include "mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 
 namespace mongo {
diff --git a/src/mongo/db/matcher/extensions_callback_real.cpp b/src/mongo/db/matcher/extensions_callback_real.cpp
index 87e0e175d6..d8a0071a14 100644
--- a/src/mongo/db/matcher/extensions_callback_real.cpp
+++ b/src/mongo/db/matcher/extensions_callback_real.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/matcher/expression_text.h"
 #include "mongo/db/matcher/expression_where.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/expression_function.h"
+#include "mongo/db/pipeline/expression/expression_function.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/scripting/engine.h"
diff --git a/src/mongo/db/matcher/rewrite_expr.h b/src/mongo/db/matcher/rewrite_expr.h
index 1752c9726b..4603e74be8 100644
--- a/src/mongo/db/matcher/rewrite_expr.h
+++ b/src/mongo/db/matcher/rewrite_expr.h
@@ -35,7 +35,7 @@
 #include "mongo/db/matcher/expression.h"
 #include "mongo/db/matcher/expression_leaf.h"
 #include "mongo/db/matcher/expression_tree.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/SConscript b/src/mongo/db/pipeline/SConscript
index dff5f65999..e6a9d1f2db 100644
--- a/src/mongo/db/pipeline/SConscript
+++ b/src/mongo/db/pipeline/SConscript
@@ -71,12 +71,12 @@ env.Library(
 env.Library(
     target='expression_context',
     source=[
-        'expression.cpp',
+        'expression/expression.cpp',
         'expression_context.cpp',
-        'expression_function.cpp',
-        'expression_js_emit.cpp',
-        'expression_test_api_version.cpp',
-        'expression_trigonometric.cpp',
+        'expression/expression_function.cpp',
+        'expression/expression_js_emit.cpp',
+        'expression/expression_test_api_version.cpp',
+        'expression/expression_trigonometric.cpp',
         'javascript_execution.cpp',
         'make_js_function.cpp',
         'variables.cpp',
@@ -119,21 +119,21 @@ env.Library(
 env.Library(
     target='accumulator',
     source=[
-        'accumulation_statement.cpp',
-        'accumulator_add_to_set.cpp',
-        'accumulator_avg.cpp',
-        'accumulator_covariance.cpp',
-        'accumulator_exp_moving_avg.cpp',
-        'accumulator_first.cpp',
-        'accumulator_integral.cpp',
-        'accumulator_js_reduce.cpp',
-        'accumulator_last.cpp',
-        'accumulator_merge_objects.cpp',
-        'accumulator_min_max.cpp',
-        'accumulator_push.cpp',
-        'accumulator_rank.cpp',
-        'accumulator_std_dev.cpp',
-        'accumulator_sum.cpp',
+        'accumulator/accumulation_statement.cpp',
+        'accumulator/accumulator_add_to_set.cpp',
+        'accumulator/accumulator_avg.cpp',
+        'accumulator/accumulator_covariance.cpp',
+        'accumulator/accumulator_exp_moving_avg.cpp',
+        'accumulator/accumulator_first.cpp',
+        'accumulator/accumulator_integral.cpp',
+        'accumulator/accumulator_js_reduce.cpp',
+        'accumulator/accumulator_last.cpp',
+        'accumulator/accumulator_merge_objects.cpp',
+        'accumulator/accumulator_min_max.cpp',
+        'accumulator/accumulator_push.cpp',
+        'accumulator/accumulator_rank.cpp',
+        'accumulator/accumulator_std_dev.cpp',
+        'accumulator/accumulator_sum.cpp',
         'window_function/window_bounds.cpp',
         'window_function/window_function_covariance.cpp',
         'window_function/window_function_count.cpp',
@@ -169,7 +169,7 @@ env.Library(
 env.Library(
     target='document_source_mock',
     source=[
-        'document_source_mock.cpp',
+        'document_source/document_source_mock.cpp',
         'process_interface/stub_lookup_single_document_process_interface.cpp',
         ],
     LIBDEPS=[
@@ -229,50 +229,50 @@ pipelineEnv.InjectThirdParty(libraries=['snappy'])
 pipelineEnv.Library(
     target='pipeline',
     source=[
-        'document_source.cpp',
-        'document_source_add_fields.cpp',
-        'document_source_bucket.cpp',
-        'document_source_bucket_auto.cpp',
-        'document_source_coll_stats.cpp',
-        'document_source_count.cpp',
-        'document_source_current_op.cpp',
-        'document_source_densify.cpp',
-        'document_source_exchange.cpp',
-        'document_source_facet.cpp',
-        'document_source_geo_near.cpp',
-        'document_source_graph_lookup.cpp',
-        'document_source_group.cpp',
-        'document_source_index_stats.cpp',
-        'document_source_internal_inhibit_optimization.cpp',
-        'document_source_internal_shard_filter.cpp',
-        'document_source_internal_split_pipeline.cpp',
-        'document_source_limit.cpp',
-        'document_source_list_cached_and_active_users.cpp',
-        'document_source_list_local_sessions.cpp',
-        'document_source_list_sessions.cpp',
-        'document_source_lookup.cpp',
-        'document_source_match.cpp',
-        'document_source_merge.cpp',
-        'document_source_operation_metrics.cpp',
-        'document_source_out.cpp',
-        'document_source_plan_cache_stats.cpp',
-        'document_source_project.cpp',
-        'document_source_queue.cpp',
-        'document_source_redact.cpp',
-        'document_source_replace_root.cpp',
-        'document_source_sample.cpp',
-        'document_source_sample_from_random_cursor.cpp',
-        'document_source_sequential_document_cache.cpp',
-        'document_source_set_window_fields.cpp',
-        'document_source_single_document_transformation.cpp',
-        'document_source_skip.cpp',
-        'document_source_sort.cpp',
-        'document_source_sort_by_count.cpp',
-        'document_source_tee_consumer.cpp',
-        'document_source_union_with.cpp',
-        'document_source_unwind.cpp',
-        'document_source_internal_unpack_bucket.cpp',
-        'document_source_internal_convert_bucket_index_stats.cpp',
+        'document_source/document_source.cpp',
+        'document_source/document_source_add_fields.cpp',
+        'document_source/document_source_bucket.cpp',
+        'document_source/document_source_bucket_auto.cpp',
+        'document_source/document_source_coll_stats.cpp',
+        'document_source/document_source_count.cpp',
+        'document_source/document_source_current_op.cpp',
+        'document_source/document_source_densify.cpp',
+        'document_source/document_source_exchange.cpp',
+        'document_source/document_source_facet.cpp',
+        'document_source/document_source_geo_near.cpp',
+        'document_source/document_source_graph_lookup.cpp',
+        'document_source/document_source_group.cpp',
+        'document_source/document_source_index_stats.cpp',
+        'document_source/document_source_internal_inhibit_optimization.cpp',
+        'document_source/document_source_internal_shard_filter.cpp',
+        'document_source/document_source_internal_split_pipeline.cpp',
+        'document_source/document_source_limit.cpp',
+        'document_source/document_source_list_cached_and_active_users.cpp',
+        'document_source/document_source_list_local_sessions.cpp',
+        'document_source/document_source_list_sessions.cpp',
+        'document_source/document_source_lookup.cpp',
+        'document_source/document_source_match.cpp',
+        'document_source/document_source_merge.cpp',
+        'document_source/document_source_operation_metrics.cpp',
+        'document_source/document_source_out.cpp',
+        'document_source/document_source_plan_cache_stats.cpp',
+        'document_source/document_source_project.cpp',
+        'document_source/document_source_queue.cpp',
+        'document_source/document_source_redact.cpp',
+        'document_source/document_source_replace_root.cpp',
+        'document_source/document_source_sample.cpp',
+        'document_source/document_source_sample_from_random_cursor.cpp',
+        'document_source/document_source_sequential_document_cache.cpp',
+        'document_source/document_source_set_window_fields.cpp',
+        'document_source/document_source_single_document_transformation.cpp',
+        'document_source/document_source_skip.cpp',
+        'document_source/document_source_sort.cpp',
+        'document_source/document_source_sort_by_count.cpp',
+        'document_source/document_source_tee_consumer.cpp',
+        'document_source/document_source_union_with.cpp',
+        'document_source/document_source_unwind.cpp',
+        'document_source/document_source_internal_unpack_bucket.cpp',
+        'document_source/document_source_internal_convert_bucket_index_stats.cpp',
         'pipeline.cpp',
         'semantic_analysis.cpp',
         'sequential_document_cache.cpp',
@@ -342,18 +342,18 @@ env.Library(
     source=[
         'change_stream_document_diff_parser.cpp',
         'change_stream_helpers_legacy.cpp',
-        'document_source_change_stream.cpp',
-        'document_source_change_stream_check_invalidate.cpp',
-        'document_source_change_stream_check_resumability.cpp',
-        'document_source_change_stream_check_topology_change.cpp',
-        'document_source_change_stream_close_cursor.cpp',
-        'document_source_change_stream_ensure_resume_token_present.cpp',
-        'document_source_change_stream_handle_topology_change.cpp',
-        'document_source_change_stream_lookup_post_image.cpp',
-        'document_source_change_stream_lookup_pre_image.cpp',
-        'document_source_change_stream_oplog_match.cpp',
-        'document_source_change_stream_transform.cpp',
-        'document_source_change_stream_unwind_transactions.cpp',
+        'change_stream/document_source_change_stream.cpp',
+        'change_stream/document_source_change_stream_check_invalidate.cpp',
+        'change_stream/document_source_change_stream_check_resumability.cpp',
+        'change_stream/document_source_change_stream_check_topology_change.cpp',
+        'change_stream/document_source_change_stream_close_cursor.cpp',
+        'change_stream/document_source_change_stream_ensure_resume_token_present.cpp',
+        'change_stream/document_source_change_stream_handle_topology_change.cpp',
+        'change_stream/document_source_change_stream_lookup_post_image.cpp',
+        'change_stream/document_source_change_stream_lookup_pre_image.cpp',
+        'change_stream/document_source_change_stream_oplog_match.cpp',
+        'change_stream/document_source_change_stream_transform.cpp',
+        'change_stream/document_source_change_stream_unwind_transactions.cpp',
     ],
     LIBDEPS=[
         '$BUILD_DIR/mongo/db/pipeline/pipeline',
@@ -376,16 +376,16 @@ env.Library(
 env.Library(
     target='document_sources_idl',
     source=[
-        'document_source_change_stream.idl',
-        'document_source_coll_stats.idl',
-        'document_source_list_sessions.idl',
-        'document_source_merge.idl',
-        'document_source_merge_modes.idl',
-        'document_source_merge_spec.cpp',
-        'document_source_parsing_validators.cpp',
-        'document_source_replace_root.idl',
-        'document_source_set_window_fields.idl',
-        'document_source_union_with.idl',
+        'change_stream/document_source_change_stream.idl',
+        'document_source/document_source_coll_stats.idl',
+        'document_source/document_source_list_sessions.idl',
+        'document_source/document_source_merge.idl',
+        'document_source/document_source_merge_modes.idl',
+        'document_source/document_source_merge_spec.cpp',
+        'document_source/document_source_parsing_validators.cpp',
+        'document_source/document_source_replace_root.idl',
+        'document_source/document_source_set_window_fields.idl',
+        'document_source/document_source_union_with.idl',
         'exchange_spec.idl',
         'resume_token.cpp',
         'storage_stats_spec.idl',
@@ -404,46 +404,46 @@ env.Library(
 env.CppUnitTest(
     target='db_pipeline_test',
     source=[
-        'accumulator_js_test.cpp' if get_option('js-engine') != 'none' else [],
-        'accumulator_test.cpp',
+        'accumulator/accumulator_js_test.cpp' if get_option('js-engine') != 'none' else [],
+        'accumulator/accumulator_test.cpp',
         'aggregation_request_test.cpp',
         'dependencies_test.cpp',
         'dispatch_shard_pipeline_test.cpp',
         'document_path_support_test.cpp',
-        'document_source_add_fields_test.cpp',
-        'document_source_bucket_auto_test.cpp',
-        'document_source_bucket_test.cpp',
-        'document_source_change_stream_test.cpp',
-        'document_source_check_resume_token_test.cpp',
-        'document_source_count_test.cpp',
-        'document_source_current_op_test.cpp',
-        'document_source_densify_test.cpp',
-        'document_source_exchange_test.cpp',
-        'document_source_facet_test.cpp',
-        'document_source_geo_near_test.cpp',
-        'document_source_graph_lookup_test.cpp',
-        'document_source_group_test.cpp',
-        'document_source_internal_shard_filter_test.cpp',
-        'document_source_internal_split_pipeline_test.cpp',
-        'document_source_limit_test.cpp',
-        'document_source_change_stream_lookup_post_image_test.cpp',
-        'document_source_lookup_test.cpp',
-        'document_source_match_test.cpp',
-        'document_source_merge_cursors_test.cpp',
-        'document_source_merge_test.cpp',
-        'document_source_mock_test.cpp',
-        'document_source_out_test.cpp',
-        'document_source_plan_cache_stats_test.cpp',
-        'document_source_project_test.cpp',
-        'document_source_redact_test.cpp',
-        'document_source_replace_root_test.cpp',
-        'document_source_sample_test.cpp',
-        'document_source_sequential_document_cache_test.cpp',
-        'document_source_set_window_fields_test.cpp',
-        'document_source_skip_test.cpp',
-        'document_source_sort_by_count_test.cpp',
-        'document_source_sort_test.cpp',
-        'document_source_union_with_test.cpp',
+        'document_source/document_source_add_fields_test.cpp',
+        'document_source/document_source_bucket_auto_test.cpp',
+        'document_source/document_source_bucket_test.cpp',
+        'change_stream/document_source_change_stream_test.cpp',
+        'document_source/document_source_check_resume_token_test.cpp',
+        'document_source/document_source_count_test.cpp',
+        'document_source/document_source_current_op_test.cpp',
+        'document_source/document_source_densify_test.cpp',
+        'document_source/document_source_exchange_test.cpp',
+        'document_source/document_source_facet_test.cpp',
+        'document_source/document_source_geo_near_test.cpp',
+        'document_source/document_source_graph_lookup_test.cpp',
+        'document_source/document_source_group_test.cpp',
+        'document_source/document_source_internal_shard_filter_test.cpp',
+        'document_source/document_source_internal_split_pipeline_test.cpp',
+        'document_source/document_source_limit_test.cpp',
+        'change_stream/document_source_change_stream_lookup_post_image_test.cpp',
+        'document_source/document_source_lookup_test.cpp',
+        'document_source/document_source_match_test.cpp',
+        'document_source/document_source_merge_cursors_test.cpp',
+        'document_source/document_source_merge_test.cpp',
+        'document_source/document_source_mock_test.cpp',
+        'document_source/document_source_out_test.cpp',
+        'document_source/document_source_plan_cache_stats_test.cpp',
+        'document_source/document_source_project_test.cpp',
+        'document_source/document_source_redact_test.cpp',
+        'document_source/document_source_replace_root_test.cpp',
+        'document_source/document_source_sample_test.cpp',
+        'document_source/document_source_sequential_document_cache_test.cpp',
+        'document_source/document_source_set_window_fields_test.cpp',
+        'document_source/document_source_skip_test.cpp',
+        'document_source/document_source_sort_by_count_test.cpp',
+        'document_source/document_source_sort_test.cpp',
+        'document_source/document_source_union_with_test.cpp',
         'document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp',
         'document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp',
         'document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp',
@@ -453,26 +453,26 @@ env.CppUnitTest(
         'document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp',
         'document_source_internal_unpack_bucket_test/sample_reorder_test.cpp',
         'document_source_internal_unpack_bucket_test/sort_reorder_test.cpp',
-        'document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp',
         'document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp',
-        'document_source_unwind_test.cpp',
-        'expression_and_test.cpp',
-        'expression_compare_test.cpp',
+        'document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp',
+        'document_source/document_source_unwind_test.cpp',
+        'expression/expression_and_test.cpp',
+        'expression/expression_compare_test.cpp',
         'expression_context_test.cpp',
-        'expression_convert_test.cpp',
-        'expression_date_test.cpp',
-        'expression_field_path_test.cpp',
-        'expression_find_internal_test.cpp',
-        'expression_javascript_test.cpp' if get_option('js-engine') != 'none' else [],
-        'expression_nary_test.cpp',
-        'expression_object_test.cpp',
-        'expression_or_test.cpp',
-        'expression_replace_test.cpp',
-        'expression_test.cpp',
-        'expression_test_api_version_test.cpp',
-        'expression_trigonometric_test.cpp',
-        'expression_trim_test.cpp',
-        'expression_walker_test.cpp',
+        'expression/expression_convert_test.cpp',
+        'expression/expression_date_test.cpp',
+        'expression/expression_field_path_test.cpp',
+        'expression/expression_find_internal_test.cpp',
+        'expression/expression_javascript_test.cpp' if get_option('js-engine') != 'none' else [],
+        'expression/expression_nary_test.cpp',
+        'expression/expression_object_test.cpp',
+        'expression/expression_or_test.cpp',
+        'expression/expression_replace_test.cpp',
+        'expression/expression_test.cpp',
+        'expression/expression_test_api_version_test.cpp',
+        'expression/expression_trigonometric_test.cpp',
+        'expression/expression_trim_test.cpp',
+        'expression/expression_walker_test.cpp',
         'field_path_test.cpp',
         'granularity_rounder_powers_of_two_test.cpp',
         'granularity_rounder_preferred_numbers_test.cpp',
@@ -543,7 +543,7 @@ env.CppUnitTest(
 env.Benchmark(
     target='expression_bm',
     source=[
-        'expression_bm.cpp',
+        'expression/expression_bm.cpp',
     ],
     LIBDEPS=[
         '$BUILD_DIR/mongo/db/query/query_test_service_context',
diff --git a/src/mongo/db/pipeline/accumulation_statement.cpp b/src/mongo/db/pipeline/accumulator/accumulation_statement.cpp
similarity index 97%
rename from src/mongo/db/pipeline/accumulation_statement.cpp
rename to src/mongo/db/pipeline/accumulator/accumulation_statement.cpp
index 77981c189c..0206a44ebd 100644
--- a/src/mongo/db/pipeline/accumulation_statement.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulation_statement.cpp
@@ -32,11 +32,11 @@
 #include <boost/intrusive_ptr.hpp>
 #include <string>
 
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 
 #include "mongo/db/commands/feature_compatibility_version_documentation.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/util/assert_util.h"
 #include "mongo/util/str.h"
 #include "mongo/util/string_map.h"
diff --git a/src/mongo/db/pipeline/accumulation_statement.h b/src/mongo/db/pipeline/accumulator/accumulation_statement.h
similarity index 98%
rename from src/mongo/db/pipeline/accumulation_statement.h
rename to src/mongo/db/pipeline/accumulator/accumulation_statement.h
index f621107421..c5b5c32519 100644
--- a/src/mongo/db/pipeline/accumulation_statement.h
+++ b/src/mongo/db/pipeline/accumulator/accumulation_statement.h
@@ -30,8 +30,8 @@
 #pragma once
 
 #include "mongo/bson/bsonelement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/accumulator.h b/src/mongo/db/pipeline/accumulator/accumulator.h
similarity index 99%
rename from src/mongo/db/pipeline/accumulator.h
rename to src/mongo/db/pipeline/accumulator/accumulator.h
index 0929a69656..4fb3d01274 100644
--- a/src/mongo/db/pipeline/accumulator.h
+++ b/src/mongo/db/pipeline/accumulator/accumulator.h
@@ -40,7 +40,7 @@
 #include "mongo/bson/bsontypes.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/stdx/unordered_set.h"
 #include "mongo/util/summation.h"
diff --git a/src/mongo/db/pipeline/accumulator_add_to_set.cpp b/src/mongo/db/pipeline/accumulator/accumulator_add_to_set.cpp
similarity index 97%
rename from src/mongo/db/pipeline/accumulator_add_to_set.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_add_to_set.cpp
index 1538ca2f7e..abafc93a63 100644
--- a/src/mongo/db/pipeline/accumulator_add_to_set.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_add_to_set.cpp
@@ -29,10 +29,10 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/window_function/window_function_add_to_set.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
diff --git a/src/mongo/db/pipeline/accumulator_avg.cpp b/src/mongo/db/pipeline/accumulator/accumulator_avg.cpp
similarity index 96%
rename from src/mongo/db/pipeline/accumulator_avg.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_avg.cpp
index 201ee31c34..8317e24853 100644
--- a/src/mongo/db/pipeline/accumulator_avg.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_avg.cpp
@@ -29,12 +29,12 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/window_function/window_function_avg.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
diff --git a/src/mongo/db/pipeline/accumulator_covariance.cpp b/src/mongo/db/pipeline/accumulator/accumulator_covariance.cpp
similarity index 93%
rename from src/mongo/db/pipeline/accumulator_covariance.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_covariance.cpp
index 785698b115..28e41f88e0 100644
--- a/src/mongo/db/pipeline/accumulator_covariance.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_covariance.cpp
@@ -31,11 +31,11 @@
 
 #include <cmath>
 
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/accumulator_exp_moving_avg.cpp b/src/mongo/db/pipeline/accumulator/accumulator_exp_moving_avg.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_exp_moving_avg.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_exp_moving_avg.cpp
index 2f2dcc93d9..3d5cd7f513 100644
--- a/src/mongo/db/pipeline/accumulator_exp_moving_avg.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_exp_moving_avg.cpp
@@ -32,11 +32,11 @@
 #include <cmath>
 #include <limits>
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/accumulator_first.cpp b/src/mongo/db/pipeline/accumulator/accumulator_first.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_first.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_first.cpp
index cfb22aef24..5a1fab1dd7 100644
--- a/src/mongo/db/pipeline/accumulator_first.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_first.cpp
@@ -29,10 +29,10 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/accumulator_for_window_functions.h b/src/mongo/db/pipeline/accumulator/accumulator_for_window_functions.h
similarity index 99%
rename from src/mongo/db/pipeline/accumulator_for_window_functions.h
rename to src/mongo/db/pipeline/accumulator/accumulator_for_window_functions.h
index 058d45f62f..160487d9ca 100644
--- a/src/mongo/db/pipeline/accumulator_for_window_functions.h
+++ b/src/mongo/db/pipeline/accumulator/accumulator_for_window_functions.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/window_function/window_function_covariance.h"
 #include "mongo/db/pipeline/window_function/window_function_integral.h"
 
diff --git a/src/mongo/db/pipeline/accumulator_integral.cpp b/src/mongo/db/pipeline/accumulator/accumulator_integral.cpp
similarity index 93%
rename from src/mongo/db/pipeline/accumulator_integral.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_integral.cpp
index 83ba68c40d..a16d95339c 100644
--- a/src/mongo/db/pipeline/accumulator_integral.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_integral.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/accumulator_js_reduce.cpp b/src/mongo/db/pipeline/accumulator/accumulator_js_reduce.cpp
similarity index 99%
rename from src/mongo/db/pipeline/accumulator_js_reduce.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_js_reduce.cpp
index e7192465d7..71d1a25027 100644
--- a/src/mongo/db/pipeline/accumulator_js_reduce.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_js_reduce.cpp
@@ -30,7 +30,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/pipeline/accumulator_js_reduce.h"
+#include "mongo/db/pipeline/accumulator/accumulator_js_reduce.h"
 #include "mongo/db/pipeline/make_js_function.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/accumulator_js_reduce.h b/src/mongo/db/pipeline/accumulator/accumulator_js_reduce.h
similarity index 98%
rename from src/mongo/db/pipeline/accumulator_js_reduce.h
rename to src/mongo/db/pipeline/accumulator/accumulator_js_reduce.h
index f072505526..5d629c8b9d 100644
--- a/src/mongo/db/pipeline/accumulator_js_reduce.h
+++ b/src/mongo/db/pipeline/accumulator/accumulator_js_reduce.h
@@ -32,8 +32,8 @@
 #include <boost/intrusive_ptr.hpp>
 #include <vector>
 
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/expression_context.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/accumulator_js_test.cpp b/src/mongo/db/pipeline/accumulator/accumulator_js_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/accumulator_js_test.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_js_test.cpp
index 953b4ce475..4b3959d46f 100644
--- a/src/mongo/db/pipeline/accumulator_js_test.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_js_test.cpp
@@ -33,7 +33,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulator_js_reduce.h"
+#include "mongo/db/pipeline/accumulator/accumulator_js_reduce.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/process_interface/standalone_process_interface.h"
 #include "mongo/db/service_context_d_test_fixture.h"
diff --git a/src/mongo/db/pipeline/accumulator_last.cpp b/src/mongo/db/pipeline/accumulator/accumulator_last.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_last.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_last.cpp
index a1dade1aef..f61847f577 100644
--- a/src/mongo/db/pipeline/accumulator_last.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_last.cpp
@@ -29,10 +29,10 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/accumulator_merge_objects.cpp b/src/mongo/db/pipeline/accumulator/accumulator_merge_objects.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_merge_objects.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_merge_objects.cpp
index 8804a8a0f0..443e48e4b6 100644
--- a/src/mongo/db/pipeline/accumulator_merge_objects.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_merge_objects.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/accumulator_min_max.cpp b/src/mongo/db/pipeline/accumulator/accumulator_min_max.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_min_max.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_min_max.cpp
index d0d3758487..855f94c157 100644
--- a/src/mongo/db/pipeline/accumulator_min_max.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_min_max.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 #include "mongo/db/pipeline/window_function/window_function_min_max.h"
 
diff --git a/src/mongo/db/pipeline/accumulator_push.cpp b/src/mongo/db/pipeline/accumulator/accumulator_push.cpp
similarity index 97%
rename from src/mongo/db/pipeline/accumulator_push.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_push.cpp
index cf3daa632a..206ff56e00 100644
--- a/src/mongo/db/pipeline/accumulator_push.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_push.cpp
@@ -29,10 +29,10 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 #include "mongo/db/pipeline/window_function/window_function_push.h"
diff --git a/src/mongo/db/pipeline/accumulator_rank.cpp b/src/mongo/db/pipeline/accumulator/accumulator_rank.cpp
similarity index 95%
rename from src/mongo/db/pipeline/accumulator_rank.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_rank.cpp
index 1ac0912744..3c530fc55b 100644
--- a/src/mongo/db/pipeline/accumulator_rank.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_rank.cpp
@@ -32,11 +32,11 @@
 #include <cmath>
 #include <limits>
 
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 #include "mongo/util/summation.h"
 
diff --git a/src/mongo/db/pipeline/accumulator_std_dev.cpp b/src/mongo/db/pipeline/accumulator/accumulator_std_dev.cpp
similarity index 96%
rename from src/mongo/db/pipeline/accumulator_std_dev.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_std_dev.cpp
index e2208d92ff..2839088f9a 100644
--- a/src/mongo/db/pipeline/accumulator_std_dev.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_std_dev.cpp
@@ -29,12 +29,12 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 #include "mongo/db/pipeline/window_function/window_function_stddev.h"
diff --git a/src/mongo/db/pipeline/accumulator_sum.cpp b/src/mongo/db/pipeline/accumulator/accumulator_sum.cpp
similarity index 97%
rename from src/mongo/db/pipeline/accumulator_sum.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_sum.cpp
index c0033f281c..7564f01a3d 100644
--- a/src/mongo/db/pipeline/accumulator_sum.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_sum.cpp
@@ -32,11 +32,10 @@
 #include <cmath>
 #include <limits>
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 #include "mongo/db/pipeline/window_function/window_function_count.h"
 #include "mongo/db/pipeline/window_function/window_function_expression.h"
 #include "mongo/db/pipeline/window_function/window_function_sum.h"
diff --git a/src/mongo/db/pipeline/accumulator_test.cpp b/src/mongo/db/pipeline/accumulator/accumulator_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/accumulator_test.cpp
rename to src/mongo/db/pipeline/accumulator/accumulator_test.cpp
index d5a07d0b3b..2543b960a0 100644
--- a/src/mongo/db/pipeline/accumulator_test.cpp
+++ b/src/mongo/db/pipeline/accumulator/accumulator_test.cpp
@@ -36,9 +36,9 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream.cpp
similarity index 93%
rename from src/mongo/db/pipeline/document_source_change_stream.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream.cpp
index c4de783703..f2c0cd233e 100644
--- a/src/mongo/db/pipeline/document_source_change_stream.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream.cpp
@@ -29,29 +29,29 @@
 
 #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 
 #include "mongo/bson/simple_bsonelement_comparator.h"
 #include "mongo/db/bson/bson_helper.h"
 #include "mongo/db/commands/feature_compatibility_version_documentation.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_transform.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h"
 #include "mongo/db/pipeline/change_stream_constants.h"
 #include "mongo/db/pipeline/change_stream_helpers_legacy.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_invalidate.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_topology_change.h"
-#include "mongo/db/pipeline/document_source_change_stream_close_cursor.h"
-#include "mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h"
-#include "mongo/db/pipeline/document_source_change_stream_handle_topology_change.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_oplog_match.h"
-#include "mongo/db/pipeline/document_source_change_stream_transform.h"
-#include "mongo/db/pipeline/document_source_change_stream_unwind_transactions.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/pipeline/resume_token.h"
 #include "mongo/db/query/query_knobs_gen.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream.h
index 29b67fe526..d76ab0e224 100644
--- a/src/mongo/db/pipeline/document_source_change_stream.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream.h
@@ -31,11 +31,11 @@
 
 #include <type_traits>
 
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_gen.h"
 #include "mongo/db/pipeline/change_stream_constants.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream_gen.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/resume_token.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream.idl b/src/mongo/db/pipeline/change_stream/document_source_change_stream.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_change_stream.idl
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream.idl
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_check_invalidate.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.cpp
index 10b60f5530..60c171ea1b 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.cpp
@@ -31,8 +31,8 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_invalidate.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/util/assert_util.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h
index 30dc1b6eed..e81efe4732 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_invalidate.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h
@@ -29,8 +29,9 @@
 
 #pragma once
 
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 #include "mongo/db/pipeline/change_stream_invalidation_info.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_resumability.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_change_stream_check_resumability.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.cpp
index c22ea8d5c7..936b26c792 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_resumability.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.cpp
@@ -30,7 +30,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/curop.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/db/repl/oplog_entry.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_resumability.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h
similarity index 95%
rename from src/mongo/db/pipeline/document_source_change_stream_check_resumability.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h
index 21fad09765..5b2a0e2508 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_resumability.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h
@@ -29,11 +29,11 @@
 
 #pragma once
 
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_gen.h"
 #include "mongo/db/pipeline/change_stream_constants.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_gen.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/resume_token.h"
 #include "mongo/db/query/query_knobs_gen.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_check_topology_change.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.cpp
index 724f6c1338..854dae916e 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_check_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h"
 
 #include "mongo/db/pipeline/change_stream_topology_change_info.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h
index 850130359e..f41d82896b 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_check_topology_change.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_close_cursor.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_close_cursor.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.cpp
index a7db8e647a..75112cb8d5 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_close_cursor.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_close_cursor.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_close_cursor.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h
similarity index 94%
rename from src/mongo/db/pipeline/document_source_change_stream_close_cursor.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h
index 16a1e13f2d..5b1fd91f24 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_close_cursor.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h
@@ -29,10 +29,10 @@
 
 #pragma once
 
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 #include "mongo/db/pipeline/change_stream_constants.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.cpp
index 7ea37e67da..c651bfe380 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h
index 57b9110791..1ec53a3721 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
 
 namespace mongo {
 /**
diff --git a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.cpp
index 962e48fe4b..9266820724 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.cpp
@@ -27,12 +27,12 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/document_source_change_stream_handle_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h"
 
 #include <algorithm>
 
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 #include "mongo/db/pipeline/change_stream_topology_change_info.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/s/catalog/type_shard.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h
index 1d240be5e3..23099c6764 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_handle_topology_change.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h
@@ -32,7 +32,7 @@
 #include <memory>
 
 #include "mongo/db/pipeline/change_stream_constants.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/s/query/document_source_merge_cursors.h"
 #include "mongo/s/shard_id.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.cpp
index 8659f71e32..d8f8a76f51 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
 
 #include "mongo/bson/simple_bsonelement_comparator.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h
index 2a7c9666e6..8041af166f 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image_test.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_lookup_post_image_test.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image_test.cpp
index 6672e54f1c..b0428086c1 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_lookup_post_image_test.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image_test.cpp
@@ -40,9 +40,9 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.cpp
index b4a7c51a73..7b3e550ec6 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.cpp
@@ -32,7 +32,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h"
 
 #include "mongo/bson/simple_bsonelement_comparator.h"
 #include "mongo/db/transaction_history_iterator.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h
index 10e4028ee4..16dd4f7c1d 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.cpp
index 5dd28772c6..bc924b495f 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.cpp
@@ -27,7 +27,7 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/document_source_change_stream_oplog_match.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h"
 #include "mongo/bson/bsonmisc.h"
 #include "mongo/db/bson/bson_helper.h"
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_oplog_match.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h
index 68755f811b..cbf281e10d 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_oplog_match.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 
 namespace mongo {
 /**
diff --git a/src/mongo/db/pipeline/document_source_change_stream_test.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_change_stream_test.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_test.cpp
index a340096f5e..705527bf9f 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_test.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_test.cpp
@@ -42,20 +42,20 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_invalidate.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
-#include "mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_oplog_match.h"
-#include "mongo/db/pipeline/document_source_change_stream_transform.h"
-#include "mongo/db/pipeline/document_source_change_stream_unwind_transactions.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_transform.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/db/repl/oplog_entry.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream_transform.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_change_stream_transform.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.cpp
index 229b922956..c87aa30395 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_transform.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.cpp
@@ -31,17 +31,18 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_transform.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_transform.h"
 
 #include "mongo/db/catalog/collection_catalog.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
 #include "mongo/db/pipeline/change_stream_document_diff_parser.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/expression.h"
-#include "mongo/db/pipeline/lite_parsed_document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/resume_token.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/db/repl/bson_extract_optime.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream_transform.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_change_stream_transform.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.h
index 46fe08b7a4..fca5639dff 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_transform.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_transform.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.cpp b/src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.cpp
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.cpp
index 7f3b20b0e6..b978c1cd30 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.cpp
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_unwind_transactions.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h"
 
 #include "mongo/db/query/query_feature_flags_gen.h"
 #include "mongo/db/transaction_history_iterator.h"
diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h b/src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h
rename to src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h
index ba71e5b6be..e673e01a07 100644
--- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transactions.h
+++ b/src/mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/change_stream_helpers_legacy.cpp b/src/mongo/db/pipeline/change_stream_helpers_legacy.cpp
index 0fff6070ba..cbdafe8f10 100644
--- a/src/mongo/db/pipeline/change_stream_helpers_legacy.cpp
+++ b/src/mongo/db/pipeline/change_stream_helpers_legacy.cpp
@@ -31,18 +31,18 @@
 
 #include "mongo/db/pipeline/change_stream_helpers_legacy.h"
 
-#include "mongo/db/pipeline/document_source_change_stream_check_invalidate.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_topology_change.h"
-#include "mongo/db/pipeline/document_source_change_stream_close_cursor.h"
-#include "mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h"
-#include "mongo/db/pipeline/document_source_change_stream_handle_topology_change.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_oplog_match.h"
-#include "mongo/db/pipeline/document_source_change_stream_transform.h"
-#include "mongo/db/pipeline/document_source_change_stream_unwind_transactions.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_invalidate.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_close_cursor.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_oplog_match.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_transform.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_unwind_transactions.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 namespace change_stream_legacy {
diff --git a/src/mongo/db/pipeline/change_stream_helpers_legacy.h b/src/mongo/db/pipeline/change_stream_helpers_legacy.h
index 4c790782a2..d00cbe940f 100644
--- a/src/mongo/db/pipeline/change_stream_helpers_legacy.h
+++ b/src/mongo/db/pipeline/change_stream_helpers_legacy.h
@@ -27,8 +27,8 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_gen.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_gen.h"
 
 namespace mongo::change_stream_legacy {
 
diff --git a/src/mongo/db/pipeline/document_source.cpp b/src/mongo/db/pipeline/document_source/document_source.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source.cpp
rename to src/mongo/db/pipeline/document_source/document_source.cpp
index 997f8c1f06..fb989b03c1 100644
--- a/src/mongo/db/pipeline/document_source.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source.cpp
@@ -29,16 +29,16 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 #include "mongo/db/commands/feature_compatibility_version_documentation.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/matcher/expression_algo.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_internal_shard_filter.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_sequential_document_cache.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_shard_filter.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_sequential_document_cache.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/semantic_analysis.h"
diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source/document_source.h
similarity index 100%
rename from src/mongo/db/pipeline/document_source.h
rename to src/mongo/db/pipeline/document_source/document_source.h
diff --git a/src/mongo/db/pipeline/document_source_add_fields.cpp b/src/mongo/db/pipeline/document_source/document_source_add_fields.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_add_fields.cpp
rename to src/mongo/db/pipeline/document_source/document_source_add_fields.cpp
index ec245402c2..eee9a027e6 100644
--- a/src/mongo/db/pipeline/document_source_add_fields.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_add_fields.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
 
 #include <boost/optional.hpp>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
diff --git a/src/mongo/db/pipeline/document_source_add_fields.h b/src/mongo/db/pipeline/document_source/document_source_add_fields.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_add_fields.h
rename to src/mongo/db/pipeline/document_source/document_source_add_fields.h
index 49cb228c73..87a9a09da6 100644
--- a/src/mongo/db/pipeline/document_source_add_fields.h
+++ b/src/mongo/db/pipeline/document_source/document_source_add_fields.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_add_fields_test.cpp b/src/mongo/db/pipeline/document_source/document_source_add_fields_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_add_fields_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_add_fields_test.cpp
index 9d3227f841..28834c3b06 100644
--- a/src/mongo/db/pipeline/document_source_add_fields_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_add_fields_test.cpp
@@ -35,9 +35,9 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/unittest/unittest.h"
 #include "mongo/util/assert_util.h"
 
diff --git a/src/mongo/db/pipeline/document_source_bucket.cpp b/src/mongo/db/pipeline/document_source/document_source_bucket.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_bucket.cpp
rename to src/mongo/db/pipeline/document_source/document_source_bucket.cpp
index 5fe098ae41..04bc9b30b5 100644
--- a/src/mongo/db/pipeline/document_source_bucket.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket.cpp
@@ -27,11 +27,11 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/document_source_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_bucket.h"
 
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_bucket.h b/src/mongo/db/pipeline/document_source/document_source_bucket.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_bucket.h
rename to src/mongo/db/pipeline/document_source/document_source_bucket.h
index 7ac16dbdd7..7e3356d060 100644
--- a/src/mongo/db/pipeline/document_source_bucket.h
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_bucket_auto.cpp b/src/mongo/db/pipeline/document_source/document_source_bucket_auto.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_bucket_auto.cpp
rename to src/mongo/db/pipeline/document_source/document_source_bucket_auto.cpp
index 6163056596..30a4a66fdd 100644
--- a/src/mongo/db/pipeline/document_source_bucket_auto.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket_auto.cpp
@@ -29,9 +29,9 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_bucket_auto.h"
+#include "mongo/db/pipeline/document_source/document_source_bucket_auto.h"
 
-#include "mongo/db/pipeline/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/stats/resource_consumption_metrics.h"
 
diff --git a/src/mongo/db/pipeline/document_source_bucket_auto.h b/src/mongo/db/pipeline/document_source/document_source_bucket_auto.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_bucket_auto.h
rename to src/mongo/db/pipeline/document_source/document_source_bucket_auto.h
index 44bd1e3f8f..c43ac60f38 100644
--- a/src/mongo/db/pipeline/document_source_bucket_auto.h
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket_auto.h
@@ -29,10 +29,10 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/granularity_rounder.h"
 #include "mongo/db/sorter/sorter.h"
 
diff --git a/src/mongo/db/pipeline/document_source_bucket_auto_test.cpp b/src/mongo/db/pipeline/document_source/document_source_bucket_auto_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_bucket_auto_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_bucket_auto_test.cpp
index 5bcad8dc0b..99caa476a0 100644
--- a/src/mongo/db/pipeline/document_source_bucket_auto_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket_auto_test.cpp
@@ -43,9 +43,9 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_bucket_auto.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_bucket_auto.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/unittest/temp_dir.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_bucket_test.cpp b/src/mongo/db/pipeline/document_source/document_source_bucket_test.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_bucket_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_bucket_test.cpp
index 7d540383e9..da12022e71 100644
--- a/src/mongo/db/pipeline/document_source_bucket_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_bucket_test.cpp
@@ -39,10 +39,10 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_bucket.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp b/src/mongo/db/pipeline/document_source/document_source_check_resume_token_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_check_resume_token_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_check_resume_token_test.cpp
index 9c470320d9..a66447e3a4 100644
--- a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_check_resume_token_test.cpp
@@ -40,9 +40,9 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/plan_stats.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_change_stream_check_resumability.h"
-#include "mongo/db/pipeline/document_source_change_stream_ensure_resume_token_present.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_check_resumability.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_ensure_resume_token_present.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/db/pipeline/resume_token.h"
diff --git a/src/mongo/db/pipeline/document_source_coll_stats.cpp b/src/mongo/db/pipeline/document_source/document_source_coll_stats.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_coll_stats.cpp
rename to src/mongo/db/pipeline/document_source/document_source_coll_stats.cpp
index e7c9681d88..3a43d78bb7 100644
--- a/src/mongo/db/pipeline/document_source_coll_stats.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_coll_stats.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_coll_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_coll_stats.h"
 
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
diff --git a/src/mongo/db/pipeline/document_source_coll_stats.h b/src/mongo/db/pipeline/document_source/document_source_coll_stats.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_coll_stats.h
rename to src/mongo/db/pipeline/document_source/document_source_coll_stats.h
index 72c6923ccd..01e05a7ffa 100644
--- a/src/mongo/db/pipeline/document_source_coll_stats.h
+++ b/src/mongo/db/pipeline/document_source/document_source_coll_stats.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_coll_stats_gen.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_coll_stats_gen.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_coll_stats.idl b/src/mongo/db/pipeline/document_source/document_source_coll_stats.idl
similarity index 97%
rename from src/mongo/db/pipeline/document_source_coll_stats.idl
rename to src/mongo/db/pipeline/document_source/document_source_coll_stats.idl
index 060c20d835..504fedb3fa 100644
--- a/src/mongo/db/pipeline/document_source_coll_stats.idl
+++ b/src/mongo/db/pipeline/document_source/document_source_coll_stats.idl
@@ -29,7 +29,7 @@
 global:
   cpp_namespace: "mongo"
   cpp_includes:
-    - "mongo/db/pipeline/document_source_parsing_validators.h"
+    - "mongo/db/pipeline/document_source/document_source_parsing_validators.h"
 
 imports:
   - "mongo/idl/basic_types.idl"
diff --git a/src/mongo/db/pipeline/document_source_count.cpp b/src/mongo/db/pipeline/document_source/document_source_count.cpp
similarity index 94%
rename from src/mongo/db/pipeline/document_source_count.cpp
rename to src/mongo/db/pipeline/document_source/document_source_count.cpp
index 988bf414da..ecfb465e84 100644
--- a/src/mongo/db/pipeline/document_source_count.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_count.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_count.h"
+#include "mongo/db/pipeline/document_source/document_source_count.h"
 
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
diff --git a/src/mongo/db/pipeline/document_source_count.h b/src/mongo/db/pipeline/document_source/document_source_count.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_count.h
rename to src/mongo/db/pipeline/document_source/document_source_count.h
index 5abc4bfca6..8f3fb8e1c3 100644
--- a/src/mongo/db/pipeline/document_source_count.h
+++ b/src/mongo/db/pipeline/document_source/document_source_count.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_count_test.cpp b/src/mongo/db/pipeline/document_source/document_source_count_test.cpp
similarity index 95%
rename from src/mongo/db/pipeline/document_source_count_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_count_test.cpp
index 9ffd8a6d12..43ceb737ad 100644
--- a/src/mongo/db/pipeline/document_source_count_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_count_test.cpp
@@ -40,9 +40,9 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_count.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_count.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
 
 namespace mongo {
 namespace {
diff --git a/src/mongo/db/pipeline/document_source_current_op.cpp b/src/mongo/db/pipeline/document_source/document_source_current_op.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_current_op.cpp
rename to src/mongo/db/pipeline/document_source/document_source_current_op.cpp
index da1dda8022..7882cd61f6 100644
--- a/src/mongo/db/pipeline/document_source_current_op.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_current_op.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_current_op.h"
+#include "mongo/db/pipeline/document_source/document_source_current_op.h"
 
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
diff --git a/src/mongo/db/pipeline/document_source_current_op.h b/src/mongo/db/pipeline/document_source/document_source_current_op.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_current_op.h
rename to src/mongo/db/pipeline/document_source/document_source_current_op.h
index 49e0be6c35..7cdcf72d0c 100644
--- a/src/mongo/db/pipeline/document_source_current_op.h
+++ b/src/mongo/db/pipeline/document_source/document_source_current_op.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_current_op_test.cpp b/src/mongo/db/pipeline/document_source/document_source_current_op_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_current_op_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_current_op_test.cpp
index 260bfbf082..696ba0b4b8 100644
--- a/src/mongo/db/pipeline/document_source_current_op_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_current_op_test.cpp
@@ -32,7 +32,7 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_current_op.h"
+#include "mongo/db/pipeline/document_source/document_source_current_op.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/unittest/unittest.h"
 #include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source/document_source_cursor.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_cursor.cpp
rename to src/mongo/db/pipeline/document_source/document_source_cursor.cpp
index 023554a1be..aadae9f99c 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_cursor.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 
 #include "mongo/db/catalog/collection.h"
 #include "mongo/db/exec/document_value/document.h"
diff --git a/src/mongo/db/pipeline/document_source_cursor.h b/src/mongo/db/pipeline/document_source/document_source_cursor.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_cursor.h
rename to src/mongo/db/pipeline/document_source/document_source_cursor.h
index 2788946637..abe1618074 100644
--- a/src/mongo/db/pipeline/document_source_cursor.h
+++ b/src/mongo/db/pipeline/document_source/document_source_cursor.h
@@ -33,7 +33,7 @@
 
 #include "mongo/db/db_raii.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/query/explain_options.h"
 #include "mongo/db/query/plan_executor.h"
 #include "mongo/db/query/plan_summary_stats.h"
diff --git a/src/mongo/db/pipeline/document_source_densify.cpp b/src/mongo/db/pipeline/document_source/document_source_densify.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_densify.cpp
rename to src/mongo/db/pipeline/document_source/document_source_densify.cpp
index c7d8b122c3..8bed48f0ab 100644
--- a/src/mongo/db/pipeline/document_source_densify.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_densify.cpp
@@ -27,7 +27,7 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/document_source_densify.h"
+#include "mongo/db/pipeline/document_source/document_source_densify.h"
 #include "mongo/util/visit_helper.h"
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_densify.h b/src/mongo/db/pipeline/document_source/document_source_densify.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_densify.h
rename to src/mongo/db/pipeline/document_source/document_source_densify.h
index 6320af4709..f4872293ee 100644
--- a/src/mongo/db/pipeline/document_source_densify.h
+++ b/src/mongo/db/pipeline/document_source/document_source_densify.h
@@ -31,7 +31,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/query/datetime/date_time_support.h"
 #include "mongo/util/time_support.h"
diff --git a/src/mongo/db/pipeline/document_source_densify_test.cpp b/src/mongo/db/pipeline/document_source/document_source_densify_test.cpp
similarity index 100%
rename from src/mongo/db/pipeline/document_source_densify_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_densify_test.cpp
diff --git a/src/mongo/db/pipeline/document_source_exchange.cpp b/src/mongo/db/pipeline/document_source/document_source_exchange.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_exchange.cpp
rename to src/mongo/db/pipeline/document_source/document_source_exchange.cpp
index 931b78f316..432a59fcb9 100644
--- a/src/mongo/db/pipeline/document_source_exchange.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_exchange.cpp
@@ -37,7 +37,7 @@
 
 #include "mongo/db/curop.h"
 #include "mongo/db/hasher.h"
-#include "mongo/db/pipeline/document_source_exchange.h"
+#include "mongo/db/pipeline/document_source/document_source_exchange.h"
 #include "mongo/db/storage/key_string.h"
 #include "mongo/logv2/log.h"
 
diff --git a/src/mongo/db/pipeline/document_source_exchange.h b/src/mongo/db/pipeline/document_source/document_source_exchange.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_exchange.h
rename to src/mongo/db/pipeline/document_source/document_source_exchange.h
index ab69ed3b01..9ee7ac5903 100644
--- a/src/mongo/db/pipeline/document_source_exchange.h
+++ b/src/mongo/db/pipeline/document_source/document_source_exchange.h
@@ -33,7 +33,7 @@
 #include <vector>
 
 #include "mongo/bson/ordering.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/exchange_spec_gen.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/platform/mutex.h"
diff --git a/src/mongo/db/pipeline/document_source_exchange_test.cpp b/src/mongo/db/pipeline/document_source/document_source_exchange_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_exchange_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_exchange_test.cpp
index ac234357b1..fcd731d222 100644
--- a/src/mongo/db/pipeline/document_source_exchange_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_exchange_test.cpp
@@ -33,8 +33,8 @@
 
 #include "mongo/db/hasher.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_exchange.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_exchange.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/storage/key_string.h"
 #include "mongo/executor/network_interface_factory.h"
 #include "mongo/executor/thread_pool_task_executor.h"
diff --git a/src/mongo/db/pipeline/document_source_facet.cpp b/src/mongo/db/pipeline/document_source/document_source_facet.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_facet.cpp
rename to src/mongo/db/pipeline/document_source/document_source_facet.cpp
index 2cee70a250..e471785830 100644
--- a/src/mongo/db/pipeline/document_source_facet.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_facet.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
 
 #include <memory>
 #include <vector>
@@ -40,7 +40,7 @@
 #include "mongo/bson/bsontypes.h"
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/document_source_tee_consumer.h"
+#include "mongo/db/pipeline/document_source/document_source_tee_consumer.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/pipeline.h"
diff --git a/src/mongo/db/pipeline/document_source_facet.h b/src/mongo/db/pipeline/document_source/document_source_facet.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_facet.h
rename to src/mongo/db/pipeline/document_source/document_source_facet.h
index f5c18e4352..271ff339e6 100644
--- a/src/mongo/db/pipeline/document_source_facet.h
+++ b/src/mongo/db/pipeline/document_source/document_source_facet.h
@@ -34,7 +34,7 @@
 #include <memory>
 #include <vector>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/pipeline.h"
diff --git a/src/mongo/db/pipeline/document_source_facet_test.cpp b/src/mongo/db/pipeline/document_source/document_source_facet_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_facet_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_facet_test.cpp
index 44e3d9668e..849de21590 100644
--- a/src/mongo/db/pipeline/document_source_facet_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_facet_test.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
 
 #include <deque>
 #include <vector>
@@ -41,9 +41,9 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/unittest/death_test.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_geo_near.cpp b/src/mongo/db/pipeline/document_source/document_source_geo_near.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_geo_near.cpp
rename to src/mongo/db/pipeline/document_source/document_source_geo_near.cpp
index a5b4978855..7c34f52517 100644
--- a/src/mongo/db/pipeline/document_source_geo_near.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_geo_near.cpp
@@ -31,10 +31,10 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_geo_near.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near.h"
 
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/logv2/log.h"
 
diff --git a/src/mongo/db/pipeline/document_source_geo_near.h b/src/mongo/db/pipeline/document_source/document_source_geo_near.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_geo_near.h
rename to src/mongo/db/pipeline/document_source/document_source_geo_near.h
index b4bc3c460e..308df2aea6 100644
--- a/src/mongo/db/pipeline/document_source_geo_near.h
+++ b/src/mongo/db/pipeline/document_source/document_source_geo_near.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/field_path.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp b/src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.cpp
similarity index 95%
rename from src/mongo/db/pipeline/document_source_geo_near_cursor.cpp
rename to src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.cpp
index 8e6885567d..fa78b1d117 100644
--- a/src/mongo/db/pipeline/document_source_geo_near_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_geo_near_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near_cursor.h"
 
 #include <boost/intrusive_ptr.hpp>
 #include <boost/optional.hpp>
@@ -42,8 +42,8 @@
 #include "mongo/bson/simple_bsonobj_comparator.h"
 #include "mongo/db/catalog/collection.h"
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/query/plan_executor.h"
diff --git a/src/mongo/db/pipeline/document_source_geo_near_cursor.h b/src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_geo_near_cursor.h
rename to src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.h
index b3ddf9a834..40559306ab 100644
--- a/src/mongo/db/pipeline/document_source_geo_near_cursor.h
+++ b/src/mongo/db/pipeline/document_source/document_source_geo_near_cursor.h
@@ -38,7 +38,7 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/catalog/collection.h"
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/query/plan_executor.h"
diff --git a/src/mongo/db/pipeline/document_source_geo_near_test.cpp b/src/mongo/db/pipeline/document_source/document_source_geo_near_test.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_geo_near_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_geo_near_test.cpp
index b9e73e6f8b..b535a2bbfb 100644
--- a/src/mongo/db/pipeline/document_source_geo_near_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_geo_near_test.cpp
@@ -35,8 +35,8 @@
 #include "mongo/bson/json.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_geo_near.h"
-#include "mongo/db/pipeline/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
 #include "mongo/db/pipeline/pipeline.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.cpp b/src/mongo/db/pipeline/document_source/document_source_graph_lookup.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_graph_lookup.cpp
rename to src/mongo/db/pipeline/document_source/document_source_graph_lookup.cpp
index eca4b8b821..8d32af773f 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_graph_lookup.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
 
 #include <memory>
 
@@ -40,8 +40,8 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/document_source_merge_gen.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_gen.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/query/query_planner_common.h"
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.h b/src/mongo/db/pipeline/document_source/document_source_graph_lookup.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_graph_lookup.h
rename to src/mongo/db/pipeline/document_source/document_source_graph_lookup.h
index ee930e1a01..d0f041084c 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup.h
+++ b/src/mongo/db/pipeline/document_source/document_source_graph_lookup.h
@@ -30,9 +30,9 @@
 #pragma once
 
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lookup_set_cache.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp b/src/mongo/db/pipeline/document_source/document_source_graph_lookup_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_graph_lookup_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_graph_lookup_test.cpp
index d22ee4b60b..707e7ac590 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_graph_lookup_test.cpp
@@ -36,8 +36,8 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_graph_lookup.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/unittest/unittest.h"
 #include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source/document_source_group.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_group.cpp
rename to src/mongo/db/pipeline/document_source/document_source_group.cpp
index 1cb4cd7d30..cecbc0705b 100644
--- a/src/mongo/db/pipeline/document_source_group.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_group.cpp
@@ -35,10 +35,10 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/stats/resource_consumption_metrics.h"
diff --git a/src/mongo/db/pipeline/document_source_group.h b/src/mongo/db/pipeline/document_source/document_source_group.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_group.h
rename to src/mongo/db/pipeline/document_source/document_source_group.h
index 5dc398800c..6abf0cf685 100644
--- a/src/mongo/db/pipeline/document_source_group.h
+++ b/src/mongo/db/pipeline/document_source/document_source_group.h
@@ -32,9 +32,9 @@
 #include <memory>
 #include <utility>
 
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/memory_usage_tracker.h"
 #include "mongo/db/pipeline/transformer_interface.h"
 #include "mongo/db/sorter/sorter.h"
diff --git a/src/mongo/db/pipeline/document_source_group_test.cpp b/src/mongo/db/pipeline/document_source/document_source_group_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_group_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_group_test.cpp
index de6252449e..7bd44f59a5 100644
--- a/src/mongo/db/pipeline/document_source_group_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_group_test.cpp
@@ -46,9 +46,9 @@
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/query_test_service_context.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/document_source_index_stats.cpp b/src/mongo/db/pipeline/document_source/document_source_index_stats.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_index_stats.cpp
rename to src/mongo/db/pipeline/document_source/document_source_index_stats.cpp
index ad6d600e74..037411ac87 100644
--- a/src/mongo/db/pipeline/document_source_index_stats.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_index_stats.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_index_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_index_stats.h"
 
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/server_options.h"
diff --git a/src/mongo/db/pipeline/document_source_index_stats.h b/src/mongo/db/pipeline/document_source/document_source_index_stats.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_index_stats.h
rename to src/mongo/db/pipeline/document_source/document_source_index_stats.h
index f70a3d4838..8155a315a8 100644
--- a/src/mongo/db/pipeline/document_source_index_stats.h
+++ b/src/mongo/db/pipeline/document_source/document_source_index_stats.h
@@ -30,7 +30,7 @@
 #pragma once
 
 #include "mongo/db/collection_index_usage_tracker.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.cpp
index 3e523696eb..cdf7c1b767 100644
--- a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.h"
 
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/exec/document_value/document.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h b/src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h
rename to src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.h
index 498518ee95..0ce18e241f 100644
--- a/src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_internal_inhibit_optimization.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.cpp
index 10f10171f0..e919cbf4cc 100644
--- a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_internal_inhibit_optimization.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h b/src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h
rename to src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.h
index cf23b7735b..d2c083dbaa 100644
--- a/src/mongo/db/pipeline/document_source_internal_inhibit_optimization.h
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_inhibit_optimization.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_shard_filter.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.cpp
index a8b112ae83..b55c4959a7 100644
--- a/src/mongo/db/pipeline/document_source_internal_shard_filter.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_internal_shard_filter.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_shard_filter.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/logv2/log.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter.h b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_shard_filter.h
rename to src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.h
index d5f18fd1ab..660c90c90c 100644
--- a/src/mongo/db/pipeline/document_source_internal_shard_filter.h
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter.h
@@ -30,7 +30,7 @@
 #pragma once
 
 #include "mongo/db/exec/shard_filterer.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter_test.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_shard_filter_test.cpp
index 55a01a23a3..682f850d4e 100644
--- a/src/mongo/db/pipeline/document_source_internal_shard_filter_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_shard_filter_test.cpp
@@ -34,8 +34,8 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/shard_filterer.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_shard_filter.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_shard_filter.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_internal_split_pipeline.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_split_pipeline.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.cpp
index c2721ff77d..5379a76bdf 100644
--- a/src/mongo/db/pipeline/document_source_internal_split_pipeline.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_internal_split_pipeline.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_split_pipeline.h
rename to src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h
index 6ac88f8a82..c49cf084f6 100644
--- a/src/mongo/db/pipeline/document_source_internal_split_pipeline.h
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_internal_split_pipeline_test.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline_test.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_internal_split_pipeline_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline_test.cpp
index 4b52c29e05..3e461cbb07 100644
--- a/src/mongo/db/pipeline/document_source_internal_split_pipeline_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_split_pipeline_test.cpp
@@ -35,7 +35,7 @@
 
 #include "mongo/db/operation_context_noop.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_split_pipeline.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h"
 #include "mongo/db/pipeline/stage_constraints.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp b/src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp
rename to src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.cpp
index 2fa8291fee..f672f1c8c4 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.cpp
@@ -32,7 +32,7 @@
 #include <algorithm>
 #include <iterator>
 
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 
 #include <string>
 #include <type_traits>
@@ -42,13 +42,13 @@
 #include "mongo/db/matcher/expression.h"
 #include "mongo/db/matcher/expression_algo.h"
 #include "mongo/db/matcher/expression_internal_expr_comparison.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/query/util/make_data_structure.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h b/src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_internal_unpack_bucket.h
rename to src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h
index d6c60c4d88..6e66b3e8f7 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.h
+++ b/src/mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h
@@ -33,8 +33,8 @@
 #include <vector>
 
 #include "mongo/db/exec/bucket_unpacker.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 
 namespace mongo {
 class DocumentSourceInternalUnpackBucket : public DocumentSource {
diff --git a/src/mongo/db/pipeline/document_source_limit.cpp b/src/mongo/db/pipeline/document_source/document_source_limit.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_limit.cpp
rename to src/mongo/db/pipeline/document_source/document_source_limit.cpp
index 1f8051fa1d..c815286009 100644
--- a/src/mongo/db/pipeline/document_source_limit.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_limit.cpp
@@ -29,12 +29,12 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/util/str.h"
diff --git a/src/mongo/db/pipeline/document_source_limit.h b/src/mongo/db/pipeline/document_source/document_source_limit.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_limit.h
rename to src/mongo/db/pipeline/document_source/document_source_limit.h
index 6fe5370b0c..5610c31f4b 100644
--- a/src/mongo/db/pipeline/document_source_limit.h
+++ b/src/mongo/db/pipeline/document_source/document_source_limit.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_limit_test.cpp b/src/mongo/db/pipeline/document_source/document_source_limit_test.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_limit_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_limit_test.cpp
index 04aa426bd1..ac228b5d1a 100644
--- a/src/mongo/db/pipeline/document_source_limit_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_limit_test.cpp
@@ -34,9 +34,9 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.cpp b/src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_list_cached_and_active_users.cpp
rename to src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.cpp
index 535d4ebb1e..f0ff3b2509 100644
--- a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_list_cached_and_active_users.h"
+#include "mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.h"
 
 #include "mongo/db/auth/authorization_session.h"
 #include "mongo/db/auth/user_name.h"
diff --git a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h b/src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_list_cached_and_active_users.h
rename to src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.h
index f1f1e25e55..e8f83b080e 100644
--- a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h
+++ b/src/mongo/db/pipeline/document_source/document_source_list_cached_and_active_users.h
@@ -32,7 +32,7 @@
 #include "mongo/bson/bsonmisc.h"
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/auth/authorization_manager.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_list_local_sessions.cpp b/src/mongo/db/pipeline/document_source/document_source_list_local_sessions.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_list_local_sessions.cpp
rename to src/mongo/db/pipeline/document_source/document_source_list_local_sessions.cpp
index f9c329ff65..f9d78bb1af 100644
--- a/src/mongo/db/pipeline/document_source_list_local_sessions.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_list_local_sessions.cpp
@@ -32,8 +32,8 @@
 #include "mongo/db/auth/authorization_session.h"
 #include "mongo/db/auth/user_name.h"
 #include "mongo/db/logical_session_id_helpers.h"
-#include "mongo/db/pipeline/document_source_list_local_sessions.h"
-#include "mongo/db/pipeline/document_source_list_sessions_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_list_local_sessions.h"
+#include "mongo/db/pipeline/document_source/document_source_list_sessions_gen.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_list_local_sessions.h b/src/mongo/db/pipeline/document_source/document_source_list_local_sessions.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_list_local_sessions.h
rename to src/mongo/db/pipeline/document_source/document_source_list_local_sessions.h
index 5306fc1fb7..38f36bf4da 100644
--- a/src/mongo/db/pipeline/document_source_list_local_sessions.h
+++ b/src/mongo/db/pipeline/document_source/document_source_list_local_sessions.h
@@ -35,8 +35,8 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/crypto/sha256_block.h"
 #include "mongo/db/logical_session_cache.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_list_sessions_gen.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_list_sessions_gen.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_list_sessions.cpp b/src/mongo/db/pipeline/document_source/document_source_list_sessions.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_list_sessions.cpp
rename to src/mongo/db/pipeline/document_source/document_source_list_sessions.cpp
index 996856b365..0178aaefe0 100644
--- a/src/mongo/db/pipeline/document_source_list_sessions.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_list_sessions.cpp
@@ -33,8 +33,8 @@
 #include "mongo/db/logical_session_id_helpers.h"
 #include "mongo/db/matcher/expression_parser.h"
 #include "mongo/db/matcher/extensions_callback_noop.h"
-#include "mongo/db/pipeline/document_source_list_sessions.h"
-#include "mongo/db/pipeline/document_source_list_sessions_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_list_sessions.h"
+#include "mongo/db/pipeline/document_source/document_source_list_sessions_gen.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_list_sessions.h b/src/mongo/db/pipeline/document_source/document_source_list_sessions.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_list_sessions.h
rename to src/mongo/db/pipeline/document_source/document_source_list_sessions.h
index 1283c6a0fa..de51de0935 100644
--- a/src/mongo/db/pipeline/document_source_list_sessions.h
+++ b/src/mongo/db/pipeline/document_source/document_source_list_sessions.h
@@ -32,8 +32,8 @@
 #include <type_traits>
 
 #include "mongo/bson/bsonelement.h"
-#include "mongo/db/pipeline/document_source_list_local_sessions.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_list_local_sessions.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/util/intrusive_counter.h"
 
diff --git a/src/mongo/db/pipeline/document_source_list_sessions.idl b/src/mongo/db/pipeline/document_source/document_source_list_sessions.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_list_sessions.idl
rename to src/mongo/db/pipeline/document_source/document_source_list_sessions.idl
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source/document_source_lookup.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_lookup.cpp
rename to src/mongo/db/pipeline/document_source/document_source_lookup.cpp
index aade4c22aa..5532c2c0ca 100644
--- a/src/mongo/db/pipeline/document_source_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_lookup.cpp
@@ -30,7 +30,7 @@
 #include "mongo/db/commands/feature_compatibility_version_parser.h"
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
 
 #include <memory>
 
@@ -41,9 +41,9 @@
 #include "mongo/db/matcher/expression_algo.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/document_source_merge_gen.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/variable_validation.h"
 #include "mongo/db/query/collation/collator_factory_interface.h"
diff --git a/src/mongo/db/pipeline/document_source_lookup.h b/src/mongo/db/pipeline/document_source/document_source_lookup.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_lookup.h
rename to src/mongo/db/pipeline/document_source/document_source_lookup.h
index 75a2fc42a4..493f358bf2 100644
--- a/src/mongo/db/pipeline/document_source_lookup.h
+++ b/src/mongo/db/pipeline/document_source/document_source_lookup.h
@@ -32,11 +32,11 @@
 #include <boost/optional.hpp>
 
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_sequential_document_cache.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_sequential_document_cache.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/lookup_set_cache.h"
 
diff --git a/src/mongo/db/pipeline/document_source_lookup_test.cpp b/src/mongo/db/pipeline/document_source/document_source_lookup_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_lookup_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_lookup_test.cpp
index f094518c66..daba7ac6c7 100644
--- a/src/mongo/db/pipeline/document_source_lookup_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_lookup_test.cpp
@@ -42,8 +42,8 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/db/query/query_knobs_gen.h"
diff --git a/src/mongo/db/pipeline/document_source_match.cpp b/src/mongo/db/pipeline/document_source/document_source_match.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_match.cpp
rename to src/mongo/db/pipeline/document_source/document_source_match.cpp
index 6686626438..4e7063512b 100644
--- a/src/mongo/db/pipeline/document_source_match.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_match.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 
 #include <algorithm>
 #include <memory>
@@ -42,7 +42,7 @@
 #include "mongo/db/matcher/expression_parser.h"
 #include "mongo/db/matcher/extensions_callback_noop.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/util/ctype.h"
 #include "mongo/util/str.h"
diff --git a/src/mongo/db/pipeline/document_source_match.h b/src/mongo/db/pipeline/document_source/document_source_match.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_match.h
rename to src/mongo/db/pipeline/document_source/document_source_match.h
index 327820105b..0aac79439c 100644
--- a/src/mongo/db/pipeline/document_source_match.h
+++ b/src/mongo/db/pipeline/document_source/document_source_match.h
@@ -36,7 +36,7 @@
 #include "mongo/client/connpool.h"
 #include "mongo/db/matcher/expression_algo.h"
 #include "mongo/db/matcher/matcher.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/util/intrusive_counter.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_match_test.cpp b/src/mongo/db/pipeline/document_source/document_source_match_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_match_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_match_test.cpp
index 703512557d..adc1184ba2 100644
--- a/src/mongo/db/pipeline/document_source_match_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_match_test.cpp
@@ -39,8 +39,8 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/logv2/log.h"
 #include "mongo/unittest/death_test.h"
diff --git a/src/mongo/db/pipeline/document_source_merge.cpp b/src/mongo/db/pipeline/document_source/document_source_merge.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_merge.cpp
rename to src/mongo/db/pipeline/document_source/document_source_merge.cpp
index 36f652c66c..729b855b65 100644
--- a/src/mongo/db/pipeline/document_source_merge.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_merge.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
 
 #include <fmt/format.h>
 #include <fmt/ostream.h>
diff --git a/src/mongo/db/pipeline/document_source_merge.h b/src/mongo/db/pipeline/document_source/document_source_merge.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_merge.h
rename to src/mongo/db/pipeline/document_source/document_source_merge.h
index 54e9620793..ba937596d9 100644
--- a/src/mongo/db/pipeline/document_source_merge.h
+++ b/src/mongo/db/pipeline/document_source/document_source_merge.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_merge_gen.h"
-#include "mongo/db/pipeline/document_source_writer.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_writer.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_merge.idl b/src/mongo/db/pipeline/document_source/document_source_merge.idl
similarity index 97%
rename from src/mongo/db/pipeline/document_source_merge.idl
rename to src/mongo/db/pipeline/document_source/document_source_merge.idl
index 4def6572dd..b981324898 100644
--- a/src/mongo/db/pipeline/document_source_merge.idl
+++ b/src/mongo/db/pipeline/document_source/document_source_merge.idl
@@ -32,10 +32,10 @@ global:
     cpp_namespace: "mongo"
     cpp_includes:
         - "mongo/db/namespace_string.h"
-        - "mongo/db/pipeline/document_source_merge_spec.h"
+        - "mongo/db/pipeline/document_source/document_source_merge_spec.h"
 
 imports:
-    - "mongo/db/pipeline/document_source_merge_modes.idl"
+    - "mongo/db/pipeline/document_source/document_source_merge_modes.idl"
     - "mongo/idl/basic_types.idl"
     - "mongo/s/chunk_version.idl"
 
diff --git a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp b/src/mongo/db/pipeline/document_source/document_source_merge_cursors_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_merge_cursors_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_merge_cursors_test.cpp
index 61b2aef0c9..2a01c7363c 100644
--- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_merge_cursors_test.cpp
@@ -39,8 +39,8 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/json.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/query/cursor_response.h"
 #include "mongo/db/query/getmore_command_gen.h"
diff --git a/src/mongo/db/pipeline/document_source_merge_modes.idl b/src/mongo/db/pipeline/document_source/document_source_merge_modes.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_merge_modes.idl
rename to src/mongo/db/pipeline/document_source/document_source_merge_modes.idl
diff --git a/src/mongo/db/pipeline/document_source_merge_spec.cpp b/src/mongo/db/pipeline/document_source/document_source_merge_spec.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_merge_spec.cpp
rename to src/mongo/db/pipeline/document_source/document_source_merge_spec.cpp
index 2ca9a21edf..5c754bf5e3 100644
--- a/src/mongo/db/pipeline/document_source_merge_spec.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_merge_spec.cpp
@@ -29,14 +29,14 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_merge_spec.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_spec.h"
 
 #include <fmt/format.h>
 
 #include "mongo/bson/bsonobjbuilder.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_merge_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_gen.h"
 
 namespace mongo {
 using namespace fmt::literals;
diff --git a/src/mongo/db/pipeline/document_source_merge_spec.h b/src/mongo/db/pipeline/document_source/document_source_merge_spec.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_merge_spec.h
rename to src/mongo/db/pipeline/document_source/document_source_merge_spec.h
index 35c353bb78..bda537af3b 100644
--- a/src/mongo/db/pipeline/document_source_merge_spec.h
+++ b/src/mongo/db/pipeline/document_source/document_source_merge_spec.h
@@ -35,7 +35,7 @@
 
 #include "mongo/base/string_data.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source_merge_modes_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_merge_modes_gen.h"
 
 namespace mongo {
 class BSONObjBuilder;
diff --git a/src/mongo/db/pipeline/document_source_merge_test.cpp b/src/mongo/db/pipeline/document_source/document_source_merge_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_merge_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_merge_test.cpp
index d58db582df..aa1a606ba3 100644
--- a/src/mongo/db/pipeline/document_source_merge_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_merge_test.cpp
@@ -34,7 +34,7 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
 #include "mongo/db/pipeline/process_interface/non_shardsvr_process_interface.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_mock.cpp b/src/mongo/db/pipeline/document_source/document_source_mock.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_mock.cpp
rename to src/mongo/db/pipeline/document_source/document_source_mock.cpp
index 4567f5e217..7abf4be1cf 100644
--- a/src/mongo/db/pipeline/document_source_mock.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_mock.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/pipeline/expression_context.h"
diff --git a/src/mongo/db/pipeline/document_source_mock.h b/src/mongo/db/pipeline/document_source/document_source_mock.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_mock.h
rename to src/mongo/db/pipeline/document_source/document_source_mock.h
index 846f274753..fca0ba568d 100644
--- a/src/mongo/db/pipeline/document_source_mock.h
+++ b/src/mongo/db/pipeline/document_source/document_source_mock.h
@@ -31,7 +31,7 @@
 
 #include <deque>
 
-#include "mongo/db/pipeline/document_source_queue.h"
+#include "mongo/db/pipeline/document_source/document_source_queue.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/stage_constraints.h"
 
diff --git a/src/mongo/db/pipeline/document_source_mock_test.cpp b/src/mongo/db/pipeline/document_source/document_source_mock_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_mock_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_mock_test.cpp
index 374c860173..90b3165f68 100644
--- a/src/mongo/db/pipeline/document_source_mock_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_mock_test.cpp
@@ -32,7 +32,7 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_operation_metrics.cpp b/src/mongo/db/pipeline/document_source/document_source_operation_metrics.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_operation_metrics.cpp
rename to src/mongo/db/pipeline/document_source/document_source_operation_metrics.cpp
index 548a7b3679..59b06dbaef 100644
--- a/src/mongo/db/pipeline/document_source_operation_metrics.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_operation_metrics.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_operation_metrics.h"
+#include "mongo/db/pipeline/document_source/document_source_operation_metrics.h"
 
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/server_options.h"
diff --git a/src/mongo/db/pipeline/document_source_operation_metrics.h b/src/mongo/db/pipeline/document_source/document_source_operation_metrics.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_operation_metrics.h
rename to src/mongo/db/pipeline/document_source/document_source_operation_metrics.h
index d4e25d47bc..11d2921a47 100644
--- a/src/mongo/db/pipeline/document_source_operation_metrics.h
+++ b/src/mongo/db/pipeline/document_source/document_source_operation_metrics.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_out.cpp b/src/mongo/db/pipeline/document_source/document_source_out.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_out.cpp
rename to src/mongo/db/pipeline/document_source/document_source_out.cpp
index 1fef7bb2bd..f6891e00ab 100644
--- a/src/mongo/db/pipeline/document_source_out.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_out.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
 
 #include <fmt/format.h>
 
diff --git a/src/mongo/db/pipeline/document_source_out.h b/src/mongo/db/pipeline/document_source/document_source_out.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_out.h
rename to src/mongo/db/pipeline/document_source/document_source_out.h
index 140544897d..09f4efb8c5 100644
--- a/src/mongo/db/pipeline/document_source_out.h
+++ b/src/mongo/db/pipeline/document_source/document_source_out.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_writer.h"
+#include "mongo/db/pipeline/document_source/document_source_writer.h"
 
 namespace mongo {
 /**
diff --git a/src/mongo/db/pipeline/document_source_out_test.cpp b/src/mongo/db/pipeline/document_source/document_source_out_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_out_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_out_test.cpp
index aef9be321f..15e0283b0b 100644
--- a/src/mongo/db/pipeline/document_source_out_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_out_test.cpp
@@ -34,7 +34,7 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
 
 namespace mongo {
 namespace {
diff --git a/src/mongo/db/pipeline/document_source_parsing_validators.cpp b/src/mongo/db/pipeline/document_source/document_source_parsing_validators.cpp
similarity index 95%
rename from src/mongo/db/pipeline/document_source_parsing_validators.cpp
rename to src/mongo/db/pipeline/document_source/document_source_parsing_validators.cpp
index 991575c244..a575cb66e9 100644
--- a/src/mongo/db/pipeline/document_source_parsing_validators.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_parsing_validators.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_parsing_validators.h"
+#include "mongo/db/pipeline/document_source/document_source_parsing_validators.h"
 #include "mongo/util/str.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_parsing_validators.h b/src/mongo/db/pipeline/document_source/document_source_parsing_validators.h
similarity index 100%
rename from src/mongo/db/pipeline/document_source_parsing_validators.h
rename to src/mongo/db/pipeline/document_source/document_source_parsing_validators.h
diff --git a/src/mongo/db/pipeline/document_source_plan_cache_stats.cpp b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_plan_cache_stats.cpp
rename to src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.cpp
index bfbe60b4ec..7d6df2d008 100644
--- a/src/mongo/db/pipeline/document_source_plan_cache_stats.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_plan_cache_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_plan_cache_stats.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_plan_cache_stats.h b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_plan_cache_stats.h
rename to src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.h
index d72b0a22ac..d7e2dc2493 100644
--- a/src/mongo/db/pipeline/document_source_plan_cache_stats.h
+++ b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_plan_cache_stats_test.cpp b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_plan_cache_stats_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_plan_cache_stats_test.cpp
index 4f89e47acd..2771bba0de 100644
--- a/src/mongo/db/pipeline/document_source_plan_cache_stats_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_plan_cache_stats_test.cpp
@@ -33,7 +33,7 @@
 
 #include "mongo/bson/json.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_plan_cache_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_plan_cache_stats.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_project.cpp b/src/mongo/db/pipeline/document_source/document_source_project.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_project.cpp
rename to src/mongo/db/pipeline/document_source/document_source_project.cpp
index 3630cae344..d9f337b6b3 100644
--- a/src/mongo/db/pipeline/document_source_project.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_project.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
 
 #include <boost/optional.hpp>
 #include <boost/smart_ptr/intrusive_ptr.hpp>
diff --git a/src/mongo/db/pipeline/document_source_project.h b/src/mongo/db/pipeline/document_source/document_source_project.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_project.h
rename to src/mongo/db/pipeline/document_source/document_source_project.h
index 9401231a56..3c5af002b4 100644
--- a/src/mongo/db/pipeline/document_source_project.h
+++ b/src/mongo/db/pipeline/document_source/document_source_project.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
 #include "mongo/db/query/projection_parser.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_project_test.cpp b/src/mongo/db/pipeline/document_source/document_source_project_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_project_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_project_test.cpp
index ced99ce020..7dc29e3aea 100644
--- a/src/mongo/db/pipeline/document_source_project_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_project_test.cpp
@@ -40,8 +40,8 @@
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
 #include "mongo/db/pipeline/semantic_analysis.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_queue.cpp b/src/mongo/db/pipeline/document_source/document_source_queue.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_queue.cpp
rename to src/mongo/db/pipeline/document_source/document_source_queue.cpp
index 12b8157117..44750f438c 100644
--- a/src/mongo/db/pipeline/document_source_queue.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_queue.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_queue.h"
+#include "mongo/db/pipeline/document_source/document_source_queue.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_queue.h b/src/mongo/db/pipeline/document_source/document_source_queue.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_queue.h
rename to src/mongo/db/pipeline/document_source/document_source_queue.h
index 4c91abdf44..670c4b7c1f 100644
--- a/src/mongo/db/pipeline/document_source_queue.h
+++ b/src/mongo/db/pipeline/document_source/document_source_queue.h
@@ -31,7 +31,7 @@
 
 #include <deque>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_redact.cpp b/src/mongo/db/pipeline/document_source/document_source_redact.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_redact.cpp
rename to src/mongo/db/pipeline/document_source/document_source_redact.cpp
index eaefcdf672..4b41b239a6 100644
--- a/src/mongo/db/pipeline/document_source_redact.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_redact.cpp
@@ -29,15 +29,15 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_redact.h"
+#include "mongo/db/pipeline/document_source/document_source_redact.h"
 
 #include <boost/optional.hpp>
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_redact.h b/src/mongo/db/pipeline/document_source/document_source_redact.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_redact.h
rename to src/mongo/db/pipeline/document_source/document_source_redact.h
index 10fcfc14f6..5dddb33c17 100644
--- a/src/mongo/db/pipeline/document_source_redact.h
+++ b/src/mongo/db/pipeline/document_source/document_source_redact.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_redact_test.cpp b/src/mongo/db/pipeline/document_source/document_source_redact_test.cpp
similarity index 94%
rename from src/mongo/db/pipeline/document_source_redact_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_redact_test.cpp
index 95d001e4da..dae287b1c8 100644
--- a/src/mongo/db/pipeline/document_source_redact_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_redact_test.cpp
@@ -33,9 +33,9 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/bson/bsonobjbuilder.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_redact.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_redact.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/document_source_replace_root.cpp b/src/mongo/db/pipeline/document_source/document_source_replace_root.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_replace_root.cpp
rename to src/mongo/db/pipeline/document_source/document_source_replace_root.cpp
index 084d7398fb..271a6e35ca 100644
--- a/src/mongo/db/pipeline/document_source_replace_root.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_replace_root.cpp
@@ -29,13 +29,13 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
 
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/document_source_replace_root_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root_gen.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_replace_root.h b/src/mongo/db/pipeline/document_source/document_source_replace_root.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_replace_root.h
rename to src/mongo/db/pipeline/document_source/document_source_replace_root.h
index e0d8482d55..e9a861deac 100644
--- a/src/mongo/db/pipeline/document_source_replace_root.h
+++ b/src/mongo/db/pipeline/document_source/document_source_replace_root.h
@@ -30,8 +30,8 @@
 #pragma once
 
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_replace_root.idl b/src/mongo/db/pipeline/document_source/document_source_replace_root.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_replace_root.idl
rename to src/mongo/db/pipeline/document_source/document_source_replace_root.idl
diff --git a/src/mongo/db/pipeline/document_source_replace_root_test.cpp b/src/mongo/db/pipeline/document_source/document_source_replace_root_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_replace_root_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_replace_root_test.cpp
index 0397784b7f..ebfe3f8e57 100644
--- a/src/mongo/db/pipeline/document_source_replace_root_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_replace_root_test.cpp
@@ -37,8 +37,8 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_sample.cpp b/src/mongo/db/pipeline/document_source/document_source_sample.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_sample.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sample.cpp
index 57d5661c38..6e1474844b 100644
--- a/src/mongo/db/pipeline/document_source_sample.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sample.cpp
@@ -29,12 +29,12 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
 
 #include "mongo/db/client.h"
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
diff --git a/src/mongo/db/pipeline/document_source_sample.h b/src/mongo/db/pipeline/document_source/document_source_sample.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_sample.h
rename to src/mongo/db/pipeline/document_source/document_source_sample.h
index 7dd31db3c4..b767e416cb 100644
--- a/src/mongo/db/pipeline/document_source_sample.h
+++ b/src/mongo/db/pipeline/document_source/document_source_sample.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.cpp b/src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_sample_from_random_cursor.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.cpp
index 1105966e3a..a551dc9096 100644
--- a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.cpp
@@ -31,14 +31,14 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_sample_from_random_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h"
 
 #include <boost/math/distributions/beta.hpp>
 
 #include "mongo/db/client.h"
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/logv2/log.h"
 
diff --git a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h b/src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_sample_from_random_cursor.h
rename to src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h
index 6552148815..b69fc5f6cd 100644
--- a/src/mongo/db/pipeline/document_source_sample_from_random_cursor.h
+++ b/src/mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h
@@ -30,7 +30,7 @@
 #pragma once
 
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_sample_test.cpp b/src/mongo/db/pipeline/document_source/document_source_sample_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_sample_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sample_test.cpp
index 68cd93c469..47264c7a43 100644
--- a/src/mongo/db/pipeline/document_source_sample_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sample_test.cpp
@@ -37,9 +37,9 @@
 #include "mongo/bson/bsonobjbuilder.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_sample_from_random_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/unittest/death_test.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_sequential_document_cache.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.cpp
index 74256f4147..0cd5dcb64b 100644
--- a/src/mongo/db/pipeline/document_source_sequential_document_cache.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.cpp
@@ -29,9 +29,9 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_sequential_document_cache.h"
+#include "mongo/db/pipeline/document_source/document_source_sequential_document_cache.h"
 
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache.h b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_sequential_document_cache.h
rename to src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.h
index 355a7d3437..32f97f4f4b 100644
--- a/src/mongo/db/pipeline/document_source_sequential_document_cache.h
+++ b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/sequential_document_cache.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_sequential_document_cache_test.cpp b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache_test.cpp
similarity index 95%
rename from src/mongo/db/pipeline/document_source_sequential_document_cache_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sequential_document_cache_test.cpp
index d4480ca7c5..76fd4d9ad6 100644
--- a/src/mongo/db/pipeline/document_source_sequential_document_cache_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sequential_document_cache_test.cpp
@@ -35,8 +35,8 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/bson/json.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sequential_document_cache.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sequential_document_cache.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_set_window_fields.cpp b/src/mongo/db/pipeline/document_source/document_source_set_window_fields.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_set_window_fields.cpp
rename to src/mongo/db/pipeline/document_source/document_source_set_window_fields.cpp
index 1e3f549edb..ede7aff5a5 100644
--- a/src/mongo/db/pipeline/document_source_set_window_fields.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_set_window_fields.cpp
@@ -31,11 +31,11 @@
 
 #include "mongo/db/exec/add_fields_projection_executor.h"
 #include "mongo/db/matcher/expression_algo.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_set_window_fields.h"
-#include "mongo/db/pipeline/document_source_set_window_fields_gen.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/query/sort_pattern.h"
diff --git a/src/mongo/db/pipeline/document_source_set_window_fields.h b/src/mongo/db/pipeline/document_source/document_source_set_window_fields.h
similarity index 96%
rename from src/mongo/db/pipeline/document_source_set_window_fields.h
rename to src/mongo/db/pipeline/document_source/document_source_set_window_fields.h
index f854de9265..c27e1b7686 100644
--- a/src/mongo/db/pipeline/document_source_set_window_fields.h
+++ b/src/mongo/db/pipeline/document_source/document_source_set_window_fields.h
@@ -29,11 +29,10 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_set_window_fields_gen.h"
-#include "mongo/db/pipeline/field_path.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields_gen.h"
 #include "mongo/db/pipeline/memory_usage_tracker.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
diff --git a/src/mongo/db/pipeline/document_source_set_window_fields.idl b/src/mongo/db/pipeline/document_source/document_source_set_window_fields.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_set_window_fields.idl
rename to src/mongo/db/pipeline/document_source/document_source_set_window_fields.idl
diff --git a/src/mongo/db/pipeline/document_source_set_window_fields_test.cpp b/src/mongo/db/pipeline/document_source/document_source_set_window_fields_test.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_set_window_fields_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_set_window_fields_test.cpp
index 287497db44..d7b04bdf2c 100644
--- a/src/mongo/db/pipeline/document_source_set_window_fields_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_set_window_fields_test.cpp
@@ -35,9 +35,9 @@
 #include "mongo/db/exec/document_value/document_comparator.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_set_window_fields.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_single_document_transformation.cpp b/src/mongo/db/pipeline/document_source/document_source_single_document_transformation.cpp
similarity index 94%
rename from src/mongo/db/pipeline/document_source_single_document_transformation.cpp
rename to src/mongo/db/pipeline/document_source/document_source_single_document_transformation.cpp
index c72c338ab9..2b36cd0125 100644
--- a/src/mongo/db/pipeline/document_source_single_document_transformation.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_single_document_transformation.cpp
@@ -29,15 +29,15 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
 
 #include <boost/smart_ptr/intrusive_ptr.hpp>
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_skip.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_single_document_transformation.h b/src/mongo/db/pipeline/document_source/document_source_single_document_transformation.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_single_document_transformation.h
rename to src/mongo/db/pipeline/document_source/document_source_single_document_transformation.h
index 958e39ad5f..1ea9e7398e 100644
--- a/src/mongo/db/pipeline/document_source_single_document_transformation.h
+++ b/src/mongo/db/pipeline/document_source/document_source_single_document_transformation.h
@@ -31,7 +31,7 @@
 
 #include <type_traits>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/transformer_interface.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_skip.cpp b/src/mongo/db/pipeline/document_source/document_source_skip.cpp
similarity index 96%
rename from src/mongo/db/pipeline/document_source_skip.cpp
rename to src/mongo/db/pipeline/document_source/document_source_skip.cpp
index 7fa58be38e..eadcb80d7c 100644
--- a/src/mongo/db/pipeline/document_source_skip.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_skip.cpp
@@ -29,13 +29,13 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/util/str.h"
diff --git a/src/mongo/db/pipeline/document_source_skip.h b/src/mongo/db/pipeline/document_source/document_source_skip.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_skip.h
rename to src/mongo/db/pipeline/document_source/document_source_skip.h
index 89dbeb95b1..4ec13722a1 100644
--- a/src/mongo/db/pipeline/document_source_skip.h
+++ b/src/mongo/db/pipeline/document_source/document_source_skip.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_skip_test.cpp b/src/mongo/db/pipeline/document_source/document_source_skip_test.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_skip_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_skip_test.cpp
index 1de0df0232..1a5bede7f9 100644
--- a/src/mongo/db/pipeline/document_source_skip_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_skip_test.cpp
@@ -32,8 +32,8 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source/document_source_sort.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_sort.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sort.cpp
index 2b01f416e5..c663d8dbbe 100644
--- a/src/mongo/db/pipeline/document_source_sort.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sort.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 
 #include <algorithm>
 
@@ -37,7 +37,7 @@
 #include "mongo/db/exec/document_value/document_comparator.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/pipeline/skip_and_limit.h"
diff --git a/src/mongo/db/pipeline/document_source_sort.h b/src/mongo/db/pipeline/document_source/document_source_sort.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_sort.h
rename to src/mongo/db/pipeline/document_source/document_source_sort.h
index 622641bbb9..d5ded5d437 100644
--- a/src/mongo/db/pipeline/document_source_sort.h
+++ b/src/mongo/db/pipeline/document_source/document_source_sort.h
@@ -31,9 +31,9 @@
 
 #include "mongo/db/exec/sort_executor.h"
 #include "mongo/db/index/sort_key_generator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/query/sort_pattern.h"
 #include "mongo/db/sorter/sorter.h"
diff --git a/src/mongo/db/pipeline/document_source_sort_by_count.cpp b/src/mongo/db/pipeline/document_source/document_source_sort_by_count.cpp
similarity index 94%
rename from src/mongo/db/pipeline/document_source_sort_by_count.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sort_by_count.cpp
index d35ec06f33..bf5e95f156 100644
--- a/src/mongo/db/pipeline/document_source_sort_by_count.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sort_by_count.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_sort_by_count.h"
+#include "mongo/db/pipeline/document_source/document_source_sort_by_count.h"
 
 #include "mongo/db/jsobj.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
diff --git a/src/mongo/db/pipeline/document_source_sort_by_count.h b/src/mongo/db/pipeline/document_source/document_source_sort_by_count.h
similarity index 97%
rename from src/mongo/db/pipeline/document_source_sort_by_count.h
rename to src/mongo/db/pipeline/document_source/document_source_sort_by_count.h
index 00493716f1..b73e4a0d2a 100644
--- a/src/mongo/db/pipeline/document_source_sort_by_count.h
+++ b/src/mongo/db/pipeline/document_source/document_source_sort_by_count.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/document_source_sort_by_count_test.cpp b/src/mongo/db/pipeline/document_source/document_source_sort_by_count_test.cpp
similarity index 95%
rename from src/mongo/db/pipeline/document_source_sort_by_count_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sort_by_count_test.cpp
index d4ab7f15c5..b13109c32a 100644
--- a/src/mongo/db/pipeline/document_source_sort_by_count_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sort_by_count_test.cpp
@@ -39,10 +39,10 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_sort_by_count.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_sort_by_count.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_sort_test.cpp b/src/mongo/db/pipeline/document_source/document_source_sort_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_sort_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_sort_test.cpp
index 980fc537f9..65fa8e9a55 100644
--- a/src/mongo/db/pipeline/document_source_sort_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_sort_test.cpp
@@ -42,8 +42,8 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/unittest/temp_dir.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/document_source_tee_consumer.cpp b/src/mongo/db/pipeline/document_source/document_source_tee_consumer.cpp
similarity index 97%
rename from src/mongo/db/pipeline/document_source_tee_consumer.cpp
rename to src/mongo/db/pipeline/document_source/document_source_tee_consumer.cpp
index 608f1c46f0..c0da29094c 100644
--- a/src/mongo/db/pipeline/document_source_tee_consumer.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_tee_consumer.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_tee_consumer.h"
+#include "mongo/db/pipeline/document_source/document_source_tee_consumer.h"
 
 #include <boost/intrusive_ptr.hpp>
 #include <boost/optional.hpp>
diff --git a/src/mongo/db/pipeline/document_source_tee_consumer.h b/src/mongo/db/pipeline/document_source/document_source_tee_consumer.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_tee_consumer.h
rename to src/mongo/db/pipeline/document_source/document_source_tee_consumer.h
index 0e7d6d5a96..e9978955d9 100644
--- a/src/mongo/db/pipeline/document_source_tee_consumer.h
+++ b/src/mongo/db/pipeline/document_source/document_source_tee_consumer.h
@@ -32,7 +32,7 @@
 #include <boost/intrusive_ptr.hpp>
 #include <boost/optional.hpp>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/tee_buffer.h"
 
diff --git a/src/mongo/db/pipeline/document_source_test_optimizations.h b/src/mongo/db/pipeline/document_source/document_source_test_optimizations.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_test_optimizations.h
rename to src/mongo/db/pipeline/document_source/document_source_test_optimizations.h
index 57f92f37f0..5d89e0b019 100644
--- a/src/mongo/db/pipeline/document_source_test_optimizations.h
+++ b/src/mongo/db/pipeline/document_source/document_source_test_optimizations.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_union_with.cpp b/src/mongo/db/pipeline/document_source/document_source_union_with.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_union_with.cpp
rename to src/mongo/db/pipeline/document_source/document_source_union_with.cpp
index 17570253cd..302c921dd2 100644
--- a/src/mongo/db/pipeline/document_source_union_with.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_union_with.cpp
@@ -33,10 +33,10 @@
 #include <iterator>
 
 #include "mongo/db/commands/test_commands_enabled.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_union_with.h"
-#include "mongo/db/pipeline/document_source_union_with_gen.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with_gen.h"
 #include "mongo/db/views/resolved_view.h"
 #include "mongo/logv2/log.h"
 
diff --git a/src/mongo/db/pipeline/document_source_union_with.h b/src/mongo/db/pipeline/document_source/document_source_union_with.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_union_with.h
rename to src/mongo/db/pipeline/document_source/document_source_union_with.h
index 02dda56665..9d0128b4a9 100644
--- a/src/mongo/db/pipeline/document_source_union_with.h
+++ b/src/mongo/db/pipeline/document_source/document_source_union_with.h
@@ -31,7 +31,7 @@
 
 #include <boost/optional.hpp>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/stage_constraints.h"
diff --git a/src/mongo/db/pipeline/document_source_union_with.idl b/src/mongo/db/pipeline/document_source/document_source_union_with.idl
similarity index 100%
rename from src/mongo/db/pipeline/document_source_union_with.idl
rename to src/mongo/db/pipeline/document_source/document_source_union_with.idl
diff --git a/src/mongo/db/pipeline/document_source_union_with_test.cpp b/src/mongo/db/pipeline/document_source/document_source_union_with_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_union_with_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_union_with_test.cpp
index 4806846682..5ba12017cf 100644
--- a/src/mongo/db/pipeline/document_source_union_with_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_union_with_test.cpp
@@ -39,13 +39,13 @@
 #include "mongo/db/exec/document_value/document_comparator.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_facet.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
-#include "mongo/db/pipeline/document_source_union_with.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/document_source_unwind.cpp b/src/mongo/db/pipeline/document_source/document_source_unwind.cpp
similarity index 98%
rename from src/mongo/db/pipeline/document_source_unwind.cpp
rename to src/mongo/db/pipeline/document_source/document_source_unwind.cpp
index ae0bfecbb9..cc2c7c4166 100644
--- a/src/mongo/db/pipeline/document_source_unwind.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_unwind.cpp
@@ -29,14 +29,14 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/matcher/expression_algo.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_unwind.h b/src/mongo/db/pipeline/document_source/document_source_unwind.h
similarity index 98%
rename from src/mongo/db/pipeline/document_source_unwind.h
rename to src/mongo/db/pipeline/document_source/document_source_unwind.h
index 9d825b213e..43924f9954 100644
--- a/src/mongo/db/pipeline/document_source_unwind.h
+++ b/src/mongo/db/pipeline/document_source/document_source_unwind.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/field_path.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_unwind_test.cpp b/src/mongo/db/pipeline/document_source/document_source_unwind_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/document_source_unwind_test.cpp
rename to src/mongo/db/pipeline/document_source/document_source_unwind_test.cpp
index aa8a550ec0..35638124ca 100644
--- a/src/mongo/db/pipeline/document_source_unwind_test.cpp
+++ b/src/mongo/db/pipeline/document_source/document_source_unwind_test.cpp
@@ -43,8 +43,8 @@
 #include "mongo/db/pipeline/aggregate_command_gen.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/query_test_service_context.h"
 #include "mongo/db/service_context.h"
diff --git a/src/mongo/db/pipeline/document_source_writer.h b/src/mongo/db/pipeline/document_source/document_source_writer.h
similarity index 99%
rename from src/mongo/db/pipeline/document_source_writer.h
rename to src/mongo/db/pipeline/document_source/document_source_writer.h
index a94b4efca6..3175ba6125 100644
--- a/src/mongo/db/pipeline/document_source_writer.h
+++ b/src/mongo/db/pipeline/document_source/document_source_writer.h
@@ -35,7 +35,7 @@
 
 #include "mongo/db/db_raii.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/read_concern.h"
 #include "mongo/db/storage/recovery_unit.h"
 
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp
index dd38554cf9..be861c4a8a 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/create_predicates_on_bucket_level_field_test.cpp
@@ -30,8 +30,8 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp
index 3bee8e7b5b..c5e9ca777f 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_or_build_project_to_internalize_test.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/bson/unordered_fields_bsonobj_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/unittest/bson_test_util.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp
index 1a82b1eb31..e3e6cfba71 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/extract_project_for_pushdown_test.cpp
@@ -31,8 +31,8 @@
 
 #include "mongo/bson/unordered_fields_bsonobj_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/unittest/bson_test_util.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/internalize_project_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/internalize_project_test.cpp
index c86ef45e44..706a7f6495 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/internalize_project_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/internalize_project_test.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/bson/unordered_fields_bsonobj_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/optimize_pipeline_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/optimize_pipeline_test.cpp
index abb15917f9..9c18432df6 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/optimize_pipeline_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/optimize_pipeline_test.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/bson/unordered_fields_bsonobj_comparator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/unittest/bson_test_util.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp
index 3f34f8cc34..8a14c60fc6 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/pushdown_computed_meta_projections_test.cpp
@@ -32,8 +32,8 @@
 #include "mongo/bson/unordered_fields_bsonobj_comparator.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp
index 18ceba57c0..66bd52893f 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/split_match_on_meta_and_rename_test.cpp
@@ -30,8 +30,8 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/util/make_data_structure.h"
 #include "mongo/unittest/bson_test_util.h"
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp
index 3566795918..382829a647 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket_test/unpack_bucket_exec_test.cpp
@@ -29,8 +29,8 @@
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/timeseries/timeseries_constants.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression/expression.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression.cpp
rename to src/mongo/db/pipeline/expression/expression.cpp
index 02a73e72a9..2516ebbdc3 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression/expression.cpp
@@ -30,7 +30,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 #include <algorithm>
 #include <boost/algorithm/string.hpp>
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression/expression.h
similarity index 99%
rename from src/mongo/db/pipeline/expression.h
rename to src/mongo/db/pipeline/expression/expression.h
index 9992f43aaa..84c5cf72dd 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression/expression.h
@@ -45,8 +45,8 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/value.h"
 #include "mongo/db/pipeline/dependencies.h"
+#include "mongo/db/pipeline/expression/expression_visitor.h"
 #include "mongo/db/pipeline/expression_context.h"
-#include "mongo/db/pipeline/expression_visitor.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/variables.h"
 #include "mongo/db/query/datetime/date_time_support.h"
diff --git a/src/mongo/db/pipeline/expression_and_test.cpp b/src/mongo/db/pipeline/expression/expression_and_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_and_test.cpp
rename to src/mongo/db/pipeline/expression/expression_and_test.cpp
index cbfa37a77d..05ad72a4c1 100644
--- a/src/mongo/db/pipeline/expression_and_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_and_test.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_bm.cpp b/src/mongo/db/pipeline/expression/expression_bm.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_bm.cpp
rename to src/mongo/db/pipeline/expression/expression_bm.cpp
index ffb4b798fd..4fd8dc8ba9 100644
--- a/src/mongo/db/pipeline/expression_bm.cpp
+++ b/src/mongo/db/pipeline/expression/expression_bm.cpp
@@ -32,7 +32,7 @@
 #include <benchmark/benchmark.h>
 
 #include "mongo/db/matcher/expression_parser.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/query_test_service_context.h"
 
diff --git a/src/mongo/db/pipeline/expression_compare_test.cpp b/src/mongo/db/pipeline/expression/expression_compare_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_compare_test.cpp
rename to src/mongo/db/pipeline/expression/expression_compare_test.cpp
index 11836d7726..0b1cded0ee 100644
--- a/src/mongo/db/pipeline/expression_compare_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_compare_test.cpp
@@ -34,7 +34,7 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/dbtests/dbtests.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/expression_convert_test.cpp b/src/mongo/db/pipeline/expression/expression_convert_test.cpp
similarity index 100%
rename from src/mongo/db/pipeline/expression_convert_test.cpp
rename to src/mongo/db/pipeline/expression/expression_convert_test.cpp
diff --git a/src/mongo/db/pipeline/expression_date_test.cpp b/src/mongo/db/pipeline/expression/expression_date_test.cpp
similarity index 100%
rename from src/mongo/db/pipeline/expression_date_test.cpp
rename to src/mongo/db/pipeline/expression/expression_date_test.cpp
diff --git a/src/mongo/db/pipeline/expression_field_path_test.cpp b/src/mongo/db/pipeline/expression/expression_field_path_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_field_path_test.cpp
rename to src/mongo/db/pipeline/expression/expression_field_path_test.cpp
index 9fa73620df..2e82a0df97 100644
--- a/src/mongo/db/pipeline/expression_field_path_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_field_path_test.cpp
@@ -34,7 +34,7 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/dbtests/dbtests.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/expression_find_internal.h b/src/mongo/db/pipeline/expression/expression_find_internal.h
similarity index 99%
rename from src/mongo/db/pipeline/expression_find_internal.h
rename to src/mongo/db/pipeline/expression/expression_find_internal.h
index 68d535e5b2..78257f1638 100644
--- a/src/mongo/db/pipeline/expression_find_internal.h
+++ b/src/mongo/db/pipeline/expression/expression_find_internal.h
@@ -33,7 +33,7 @@
 
 #include "mongo/db/exec/projection_executor_utils.h"
 #include "mongo/db/matcher/copyable_match_expression.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 /**
diff --git a/src/mongo/db/pipeline/expression_find_internal_test.cpp b/src/mongo/db/pipeline/expression/expression_find_internal_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_find_internal_test.cpp
rename to src/mongo/db/pipeline/expression/expression_find_internal_test.cpp
index 2b743d2b66..22e87f2b9a 100644
--- a/src/mongo/db/pipeline/expression_find_internal_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_find_internal_test.cpp
@@ -32,7 +32,7 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/exec/projection_executor.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/expression_find_internal.h"
+#include "mongo/db/pipeline/expression/expression_find_internal.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo::expression_internal_tests {
diff --git a/src/mongo/db/pipeline/expression_function.cpp b/src/mongo/db/pipeline/expression/expression_function.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_function.cpp
rename to src/mongo/db/pipeline/expression/expression_function.cpp
index e28acaca61..6b9a41666f 100644
--- a/src/mongo/db/pipeline/expression_function.cpp
+++ b/src/mongo/db/pipeline/expression/expression_function.cpp
@@ -27,7 +27,7 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/expression_function.h"
+#include "mongo/db/pipeline/expression/expression_function.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/expression_function.h b/src/mongo/db/pipeline/expression/expression_function.h
similarity index 98%
rename from src/mongo/db/pipeline/expression_function.h
rename to src/mongo/db/pipeline/expression/expression_function.h
index d570bdfbc8..426d225f0b 100644
--- a/src/mongo/db/pipeline/expression_function.h
+++ b/src/mongo/db/pipeline/expression/expression_function.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/javascript_execution.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/expression_javascript_test.cpp b/src/mongo/db/pipeline/expression/expression_javascript_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_javascript_test.cpp
rename to src/mongo/db/pipeline/expression/expression_javascript_test.cpp
index dc0df7cb51..63d773923d 100644
--- a/src/mongo/db/pipeline/expression_javascript_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_javascript_test.cpp
@@ -27,13 +27,13 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/expression_js_emit.h"
+#include "mongo/db/pipeline/expression/expression_js_emit.h"
 
 #include "mongo/db/commands/test_commands_enabled.h"
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
+#include "mongo/db/pipeline/expression/expression_function.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
-#include "mongo/db/pipeline/expression_function.h"
 #include "mongo/db/pipeline/process_interface/standalone_process_interface.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/service_context_d_test_fixture.h"
diff --git a/src/mongo/db/pipeline/expression_js_emit.cpp b/src/mongo/db/pipeline/expression/expression_js_emit.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_js_emit.cpp
rename to src/mongo/db/pipeline/expression/expression_js_emit.cpp
index 44242fefcf..fd6dca2774 100644
--- a/src/mongo/db/pipeline/expression_js_emit.cpp
+++ b/src/mongo/db/pipeline/expression/expression_js_emit.cpp
@@ -30,7 +30,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/pipeline/expression_js_emit.h"
+#include "mongo/db/pipeline/expression/expression_js_emit.h"
 #include "mongo/db/pipeline/make_js_function.h"
 #include "mongo/db/query/query_knobs_gen.h"
 
diff --git a/src/mongo/db/pipeline/expression_js_emit.h b/src/mongo/db/pipeline/expression/expression_js_emit.h
similarity index 98%
rename from src/mongo/db/pipeline/expression_js_emit.h
rename to src/mongo/db/pipeline/expression/expression_js_emit.h
index 7aebbf3cb1..f2d55c768e 100644
--- a/src/mongo/db/pipeline/expression_js_emit.h
+++ b/src/mongo/db/pipeline/expression/expression_js_emit.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/javascript_execution.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/expression_nary_test.cpp b/src/mongo/db/pipeline/expression/expression_nary_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_nary_test.cpp
rename to src/mongo/db/pipeline/expression/expression_nary_test.cpp
index e69fc26cc3..7953439754 100644
--- a/src/mongo/db/pipeline/expression_nary_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_nary_test.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_object_test.cpp b/src/mongo/db/pipeline/expression/expression_object_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_object_test.cpp
rename to src/mongo/db/pipeline/expression/expression_object_test.cpp
index 7246e9569e..615683ab16 100644
--- a/src/mongo/db/pipeline/expression_object_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_object_test.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_or_test.cpp b/src/mongo/db/pipeline/expression/expression_or_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_or_test.cpp
rename to src/mongo/db/pipeline/expression/expression_or_test.cpp
index ca4f5fdf84..fd3e7ccc8a 100644
--- a/src/mongo/db/pipeline/expression_or_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_or_test.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_replace_test.cpp b/src/mongo/db/pipeline/expression/expression_replace_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_replace_test.cpp
rename to src/mongo/db/pipeline/expression/expression_replace_test.cpp
index df5e19e784..20bce54fdd 100644
--- a/src/mongo/db/pipeline/expression_replace_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_replace_test.cpp
@@ -33,7 +33,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/unittest/unittest.h"
 
diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression/expression_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_test.cpp
rename to src/mongo/db/pipeline/expression/expression_test.cpp
index 88672eec4c..994d16083b 100644
--- a/src/mongo/db/pipeline/expression_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_test.cpp
@@ -39,8 +39,8 @@
 #include "mongo/db/hasher.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_test_api_version.cpp b/src/mongo/db/pipeline/expression/expression_test_api_version.cpp
similarity index 98%
rename from src/mongo/db/pipeline/expression_test_api_version.cpp
rename to src/mongo/db/pipeline/expression/expression_test_api_version.cpp
index 7c77895bff..14864e4967 100644
--- a/src/mongo/db/pipeline/expression_test_api_version.cpp
+++ b/src/mongo/db/pipeline/expression/expression_test_api_version.cpp
@@ -29,7 +29,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/api_parameters.h"
-#include "mongo/db/pipeline/expression_test_api_version.h"
+#include "mongo/db/pipeline/expression/expression_test_api_version.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/expression_test_api_version.h b/src/mongo/db/pipeline/expression/expression_test_api_version.h
similarity index 98%
rename from src/mongo/db/pipeline/expression_test_api_version.h
rename to src/mongo/db/pipeline/expression/expression_test_api_version.h
index a78464dff4..b710d4dae7 100644
--- a/src/mongo/db/pipeline/expression_test_api_version.h
+++ b/src/mongo/db/pipeline/expression/expression_test_api_version.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 /**
diff --git a/src/mongo/db/pipeline/expression_test_api_version_test.cpp b/src/mongo/db/pipeline/expression/expression_test_api_version_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/expression_test_api_version_test.cpp
rename to src/mongo/db/pipeline/expression/expression_test_api_version_test.cpp
index 05c9156ddf..eb49032789 100644
--- a/src/mongo/db/pipeline/expression_test_api_version_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_test_api_version_test.cpp
@@ -32,7 +32,7 @@
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/expression_test_api_version.h"
+#include "mongo/db/pipeline/expression/expression_test_api_version.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/expression_trigonometric.cpp b/src/mongo/db/pipeline/expression/expression_trigonometric.cpp
similarity index 100%
rename from src/mongo/db/pipeline/expression_trigonometric.cpp
rename to src/mongo/db/pipeline/expression/expression_trigonometric.cpp
diff --git a/src/mongo/db/pipeline/expression_trigonometric.h b/src/mongo/db/pipeline/expression/expression_trigonometric.h
similarity index 100%
rename from src/mongo/db/pipeline/expression_trigonometric.h
rename to src/mongo/db/pipeline/expression/expression_trigonometric.h
diff --git a/src/mongo/db/pipeline/expression_trigonometric_test.cpp b/src/mongo/db/pipeline/expression/expression_trigonometric_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_trigonometric_test.cpp
rename to src/mongo/db/pipeline/expression/expression_trigonometric_test.cpp
index 5a37a78a21..138d82ce65 100644
--- a/src/mongo/db/pipeline/expression_trigonometric_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_trigonometric_test.cpp
@@ -29,7 +29,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/expression_trigonometric.h"
+#include "mongo/db/pipeline/expression/expression_trigonometric.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
diff --git a/src/mongo/db/pipeline/expression_trim_test.cpp b/src/mongo/db/pipeline/expression/expression_trim_test.cpp
similarity index 99%
rename from src/mongo/db/pipeline/expression_trim_test.cpp
rename to src/mongo/db/pipeline/expression/expression_trim_test.cpp
index 620b371c5f..c59798dcef 100644
--- a/src/mongo/db/pipeline/expression_trim_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_trim_test.cpp
@@ -36,7 +36,7 @@
 #include "mongo/db/exec/document_value/value_comparator.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/json.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/query/collation/collator_interface_mock.h"
 #include "mongo/dbtests/dbtests.h"
diff --git a/src/mongo/db/pipeline/expression_visitor.h b/src/mongo/db/pipeline/expression/expression_visitor.h
similarity index 99%
rename from src/mongo/db/pipeline/expression_visitor.h
rename to src/mongo/db/pipeline/expression/expression_visitor.h
index 57769cfcd6..4014ad8fd8 100644
--- a/src/mongo/db/pipeline/expression_visitor.h
+++ b/src/mongo/db/pipeline/expression/expression_visitor.h
@@ -31,7 +31,7 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/expression_walker.h"
+#include "mongo/db/pipeline/expression/expression_walker.h"
 
 namespace ExpressionTests {
 class Testable;
diff --git a/src/mongo/db/pipeline/expression_walker.h b/src/mongo/db/pipeline/expression/expression_walker.h
similarity index 100%
rename from src/mongo/db/pipeline/expression_walker.h
rename to src/mongo/db/pipeline/expression/expression_walker.h
diff --git a/src/mongo/db/pipeline/expression_walker_test.cpp b/src/mongo/db/pipeline/expression/expression_walker_test.cpp
similarity index 98%
rename from src/mongo/db/pipeline/expression_walker_test.cpp
rename to src/mongo/db/pipeline/expression/expression_walker_test.cpp
index 36fbe505cc..918f1ed4e9 100644
--- a/src/mongo/db/pipeline/expression_walker_test.cpp
+++ b/src/mongo/db/pipeline/expression/expression_walker_test.cpp
@@ -40,8 +40,8 @@
 #include "mongo/db/pipeline/aggregate_command_gen.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/pipeline/expression.h"
-#include "mongo/db/pipeline/expression_walker.h"
+#include "mongo/db/pipeline/expression/expression.h"
+#include "mongo/db/pipeline/expression/expression_walker.h"
 #include "mongo/unittest/unittest.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/granularity_rounder_powers_of_two.cpp b/src/mongo/db/pipeline/granularity_rounder_powers_of_two.cpp
index aa622f9b01..45b4e51754 100644
--- a/src/mongo/db/pipeline/granularity_rounder_powers_of_two.cpp
+++ b/src/mongo/db/pipeline/granularity_rounder_powers_of_two.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/db/pipeline/granularity_rounder.h"
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/platform/bits.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp
index 437c7d17f5..0728a41676 100644
--- a/src/mongo/db/pipeline/lite_parsed_pipeline.cpp
+++ b/src/mongo/db/pipeline/lite_parsed_pipeline.cpp
@@ -32,7 +32,7 @@
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/stats/counters.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/partition_key_comparator.h b/src/mongo/db/pipeline/partition_key_comparator.h
index befc9839a5..011f4dcd1f 100644
--- a/src/mongo/db/pipeline/partition_key_comparator.h
+++ b/src/mongo/db/pipeline/partition_key_comparator.h
@@ -27,7 +27,7 @@
  *    it in the license file.
  */
 
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/memory_usage_tracker.h"
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index 131d30a916..d10d7646ee 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -36,11 +36,11 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/jsobj.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_out.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/storage/storage_options.h"
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index 2638229031..94acb8387e 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -55,18 +55,18 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/ops/write_ops_exec.h"
 #include "mongo/db/ops/write_ops_gen.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/document_source_geo_near.h"
-#include "mongo/db/pipeline/document_source_geo_near_cursor.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_sample.h"
-#include "mongo/db/pipeline/document_source_sample_from_random_cursor.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near.h"
+#include "mongo/db/pipeline/document_source/document_source_geo_near_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_sample_from_random_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/skip_and_limit.h"
 #include "mongo/db/query/collation/collator_interface.h"
diff --git a/src/mongo/db/pipeline/pipeline_d.h b/src/mongo/db/pipeline/pipeline_d.h
index 3dad7678d3..93bc771c69 100644
--- a/src/mongo/db/pipeline/pipeline_d.h
+++ b/src/mongo/db/pipeline/pipeline_d.h
@@ -36,10 +36,10 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
-#include "mongo/db/pipeline/document_source_sample.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_sample.h"
 #include "mongo/db/query/collation/collator_factory_interface.h"
 #include "mongo/db/query/plan_executor.h"
 
diff --git a/src/mongo/db/pipeline/pipeline_metadata_tree.h b/src/mongo/db/pipeline/pipeline_metadata_tree.h
index 8e82cbbdab..bf91f08c17 100644
--- a/src/mongo/db/pipeline/pipeline_metadata_tree.h
+++ b/src/mongo/db/pipeline/pipeline_metadata_tree.h
@@ -38,9 +38,9 @@
 #include <utility>
 #include <vector>
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_facet.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
 #include "mongo/db/pipeline/pipeline.h"
 
 /**
diff --git a/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp b/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
index 8b8f659759..dd7473dc50 100644
--- a/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
+++ b/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
@@ -42,17 +42,17 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/pipeline/document_source_bucket_auto.h"
-#include "mongo/db/pipeline/document_source_facet.h"
-#include "mongo/db/pipeline/document_source_graph_lookup.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_single_document_transformation.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_tee_consumer.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/document_source/document_source_bucket_auto.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_single_document_transformation.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_tee_consumer.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/pipeline_metadata_tree.h"
 #include "mongo/unittest/temp_dir.h"
diff --git a/src/mongo/db/pipeline/pipeline_test.cpp b/src/mongo/db/pipeline/pipeline_test.cpp
index 37586a16ab..bd4e3ed05a 100644
--- a/src/mongo/db/pipeline/pipeline_test.cpp
+++ b/src/mongo/db/pipeline/pipeline_test.cpp
@@ -37,21 +37,21 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/operation_context_noop.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_post_image.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_lookup_pre_image.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_post_image.h"
-#include "mongo/db/pipeline/document_source_change_stream_lookup_pre_image.h"
-#include "mongo/db/pipeline/document_source_facet.h"
-#include "mongo/db/pipeline/document_source_graph_lookup.h"
-#include "mongo/db/pipeline/document_source_internal_split_pipeline.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_test_optimizations.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_facet.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_split_pipeline.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_test_optimizations.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/field_path.h"
 #include "mongo/db/pipeline/pipeline.h"
diff --git a/src/mongo/db/pipeline/plan_explainer_pipeline.cpp b/src/mongo/db/pipeline/plan_explainer_pipeline.cpp
index 4b3bcfac0a..2ca7277716 100644
--- a/src/mongo/db/pipeline/plan_explainer_pipeline.cpp
+++ b/src/mongo/db/pipeline/plan_explainer_pipeline.cpp
@@ -31,10 +31,10 @@
 
 #include "mongo/db/pipeline/plan_explainer_pipeline.h"
 
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_union_with.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with.h"
 #include "mongo/db/pipeline/plan_executor_pipeline.h"
 #include "mongo/db/query/explain.h"
 
diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
index 95f4e91e92..b22a747458 100644
--- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
@@ -49,7 +49,7 @@
 #include "mongo/db/cursor_manager.h"
 #include "mongo/db/db_raii.h"
 #include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/pipeline_d.h"
 #include "mongo/db/query/collection_index_usage_tracker_decoration.h"
diff --git a/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp b/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
index 9461572ccf..721ba08a93 100644
--- a/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp
@@ -37,8 +37,8 @@
 #include "mongo/db/catalog/collection_catalog.h"
 #include "mongo/db/curop.h"
 #include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/query/collation/collation_spec.h"
 #include "mongo/db/query/collation/collator_factory_interface.h"
diff --git a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
index 615ff53aea..c3a13ed590 100644
--- a/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/non_shardsvr_process_interface.cpp
@@ -39,7 +39,7 @@
 #include "mongo/db/concurrency/write_conflict_exception.h"
 #include "mongo/db/db_raii.h"
 #include "mongo/db/index_builds_coordinator.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp
index eb9df64242..2b884758be 100644
--- a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.cpp
@@ -38,9 +38,9 @@
 #include "mongo/db/concurrency/d_concurrency.h"
 #include "mongo/db/db_raii.h"
 #include "mongo/db/exec/shard_filterer_impl.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
-#include "mongo/db/pipeline/document_source_internal_shard_filter.h"
-#include "mongo/db/pipeline/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_shard_filter.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/db/s/collection_sharding_state.h"
diff --git a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
index ba3fe54840..d97b451f21 100644
--- a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
+++ b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface_test.cpp
@@ -28,8 +28,8 @@
  */
 
 #include "mongo/db/concurrency/lock_state.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_queue.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_queue.h"
 #include "mongo/db/pipeline/process_interface/shardsvr_process_interface.h"
 #include "mongo/s/query/sharded_agg_test_fixture.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.cpp b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.cpp
index 0595eae3fb..e009571dbb 100644
--- a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.cpp
@@ -31,8 +31,8 @@
 
 #include "mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h"
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/util/assert_util.h"
 
diff --git a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h
index 7d00c69a0f..51e14cd056 100644
--- a/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h
+++ b/src/mongo/db/pipeline/process_interface/stub_lookup_single_document_process_interface.h
@@ -35,7 +35,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/shard_filterer.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 
diff --git a/src/mongo/db/pipeline/resharding_initial_split_policy_test.cpp b/src/mongo/db/pipeline/resharding_initial_split_policy_test.cpp
index a008cc9211..2cab78bcdf 100644
--- a/src/mongo/db/pipeline/resharding_initial_split_policy_test.cpp
+++ b/src/mongo/db/pipeline/resharding_initial_split_policy_test.cpp
@@ -32,7 +32,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/catalog/collection_catalog.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/s/config/initial_split_policy.h"
 #include "mongo/s/query/sharded_agg_test_fixture.h"
diff --git a/src/mongo/db/pipeline/resume_token.cpp b/src/mongo/db/pipeline/resume_token.cpp
index 5d3a5e78d4..1eed9fd7c2 100644
--- a/src/mongo/db/pipeline/resume_token.cpp
+++ b/src/mongo/db/pipeline/resume_token.cpp
@@ -37,7 +37,7 @@
 #include "mongo/bson/bsonmisc.h"
 #include "mongo/bson/bsonobjbuilder.h"
 #include "mongo/db/exec/document_value/value_comparator.h"
-#include "mongo/db/pipeline/document_source_change_stream_gen.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_gen.h"
 #include "mongo/db/storage/key_string.h"
 #include "mongo/util/hex.h"
 
diff --git a/src/mongo/db/pipeline/resume_token_test.cpp b/src/mongo/db/pipeline/resume_token_test.cpp
index 88be9cdc94..b7c55f26fe 100644
--- a/src/mongo/db/pipeline/resume_token_test.cpp
+++ b/src/mongo/db/pipeline/resume_token_test.cpp
@@ -36,7 +36,7 @@
 #include <random>
 
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
 #include "mongo/unittest/unittest.h"
 #include "mongo/util/hex.h"
 
diff --git a/src/mongo/db/pipeline/semantic_analysis.cpp b/src/mongo/db/pipeline/semantic_analysis.cpp
index c1613a6a85..e81515bc00 100644
--- a/src/mongo/db/pipeline/semantic_analysis.cpp
+++ b/src/mongo/db/pipeline/semantic_analysis.cpp
@@ -30,8 +30,8 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/matcher/expression_algo.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/semantic_analysis.h"
 
diff --git a/src/mongo/db/pipeline/semantic_analysis.h b/src/mongo/db/pipeline/semantic_analysis.h
index f7c0b3f56b..5732e34a53 100644
--- a/src/mongo/db/pipeline/semantic_analysis.h
+++ b/src/mongo/db/pipeline/semantic_analysis.h
@@ -33,7 +33,7 @@
 #include <set>
 #include <string>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/pipeline.h"
 
 namespace mongo::semantic_analysis {
diff --git a/src/mongo/db/pipeline/semantic_analysis_test.cpp b/src/mongo/db/pipeline/semantic_analysis_test.cpp
index ca95d9098a..59be593c91 100644
--- a/src/mongo/db/pipeline/semantic_analysis_test.cpp
+++ b/src/mongo/db/pipeline/semantic_analysis_test.cpp
@@ -33,8 +33,8 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/bson/bsonobjbuilder.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_test_optimizations.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_test_optimizations.h"
 #include "mongo/db/pipeline/semantic_analysis.h"
 #include "mongo/db/service_context_test_fixture.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.cpp b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
index 0db983a12d..9788f2a0af 100644
--- a/src/mongo/db/pipeline/sharded_agg_helpers.cpp
+++ b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
@@ -35,19 +35,19 @@
 #include "mongo/db/curop.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_change_stream_handle_topology_change.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_sequential_document_cache.h"
-#include "mongo/db/pipeline/document_source_skip.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream_handle_topology_change.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_sequential_document_cache.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/semantic_analysis.h"
 #include "mongo/db/vector_clock.h"
diff --git a/src/mongo/db/pipeline/sharded_union_test.cpp b/src/mongo/db/pipeline/sharded_union_test.cpp
index 7f1ecf1b87..adbea4bae8 100644
--- a/src/mongo/db/pipeline/sharded_union_test.cpp
+++ b/src/mongo/db/pipeline/sharded_union_test.cpp
@@ -30,10 +30,10 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_queue.h"
-#include "mongo/db/pipeline/document_source_union_with.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_queue.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with.h"
 #include "mongo/db/pipeline/process_interface/shardsvr_process_interface.h"
 #include "mongo/db/repl/read_concern_args.h"
 #include "mongo/db/views/resolved_view.h"
diff --git a/src/mongo/db/pipeline/skip_and_limit.cpp b/src/mongo/db/pipeline/skip_and_limit.cpp
index e9e7e9772c..e84317df6a 100644
--- a/src/mongo/db/pipeline/skip_and_limit.cpp
+++ b/src/mongo/db/pipeline/skip_and_limit.cpp
@@ -30,8 +30,8 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/base/exact_cast.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/db/pipeline/skip_and_limit.h"
 #include "mongo/platform/overflow_arithmetic.h"
 
diff --git a/src/mongo/db/pipeline/tee_buffer.h b/src/mongo/db/pipeline/tee_buffer.h
index 55d5aea136..1f2f7f02a3 100644
--- a/src/mongo/db/pipeline/tee_buffer.h
+++ b/src/mongo/db/pipeline/tee_buffer.h
@@ -34,7 +34,7 @@
 #include <vector>
 
 #include "mongo/db/exec/document_value/document.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/query/query_knobs_gen.h"
 #include "mongo/util/intrusive_counter.h"
 
diff --git a/src/mongo/db/pipeline/tee_buffer_test.cpp b/src/mongo/db/pipeline/tee_buffer_test.cpp
index 42fae3730b..1c195af329 100644
--- a/src/mongo/db/pipeline/tee_buffer_test.cpp
+++ b/src/mongo/db/pipeline/tee_buffer_test.cpp
@@ -34,7 +34,7 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/unittest/unittest.h"
 #include "mongo/util/assert_util.h"
 
diff --git a/src/mongo/db/pipeline/transformer_interface.h b/src/mongo/db/pipeline/transformer_interface.h
index 6be98af257..35ca953534 100644
--- a/src/mongo/db/pipeline/transformer_interface.h
+++ b/src/mongo/db/pipeline/transformer_interface.h
@@ -31,7 +31,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/query/explain_options.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/variables.cpp b/src/mongo/db/pipeline/variables.cpp
index 6adc0e280c..b5e4864591 100644
--- a/src/mongo/db/pipeline/variables.cpp
+++ b/src/mongo/db/pipeline/variables.cpp
@@ -30,7 +30,7 @@
 #include "mongo/db/pipeline/variables.h"
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/client.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/variable_validation.h"
 #include "mongo/db/vector_clock.h"
 #include "mongo/platform/basic.h"
diff --git a/src/mongo/db/pipeline/window_function/partition_iterator.h b/src/mongo/db/pipeline/window_function/partition_iterator.h
index 964c6248d8..4947024a76 100644
--- a/src/mongo/db/pipeline/window_function/partition_iterator.h
+++ b/src/mongo/db/pipeline/window_function/partition_iterator.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/memory_usage_tracker.h"
 #include "mongo/db/pipeline/partition_key_comparator.h"
 #include "mongo/db/pipeline/window_function/spillable_cache.h"
diff --git a/src/mongo/db/pipeline/window_function/partition_iterator_test.cpp b/src/mongo/db/pipeline/window_function/partition_iterator_test.cpp
index af917bd227..1920faab02 100644
--- a/src/mongo/db/pipeline/window_function/partition_iterator_test.cpp
+++ b/src/mongo/db/pipeline/window_function/partition_iterator_test.cpp
@@ -31,8 +31,8 @@
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/unittest/death_test.h"
 #include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function.h b/src/mongo/db/pipeline/window_function/window_function.h
index 6a496b9667..bbd00dde60 100644
--- a/src/mongo/db/pipeline/window_function/window_function.h
+++ b/src/mongo/db/pipeline/window_function/window_function.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_avg.h b/src/mongo/db/pipeline/window_function/window_function_avg.h
index 2dc0d09e4b..9508666e2d 100644
--- a/src/mongo/db/pipeline/window_function/window_function_avg.h
+++ b/src/mongo/db/pipeline/window_function/window_function_avg.h
@@ -29,9 +29,9 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function_sum.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/window_function/window_function_covariance.cpp b/src/mongo/db/pipeline/window_function/window_function_covariance.cpp
index cab8fdb619..e255a5b8e6 100644
--- a/src/mongo/db/pipeline/window_function/window_function_covariance.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_covariance.cpp
@@ -30,8 +30,8 @@
 #include "mongo/db/pipeline/window_function/window_function_covariance.h"
 #include "mongo/db/pipeline/window_function/window_function_sum.h"
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec.h b/src/mongo/db/pipeline/window_function/window_function_exec.h
index 1fae842490..5531aa259f 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec.h
@@ -31,9 +31,9 @@
 
 #include <queue>
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_set_window_fields.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_derivative.h b/src/mongo/db/pipeline/window_function/window_function_exec_derivative.h
index ed13364a18..637f1c2476 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_derivative.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_derivative.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_derivative_test.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_derivative_test.cpp
index 8968e47439..09a4a96958 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_derivative_test.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_derivative_test.cpp
@@ -30,11 +30,11 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec_derivative.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h b/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h
index f64b77c28f..dc3abdac43 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_first_last.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_first_last_test.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_first_last_test.cpp
index 0650321c46..4efc7c0faa 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_first_last_test.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_first_last_test.cpp
@@ -30,11 +30,11 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec_first_last.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable.h b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable.h
index 6d858d7646..a760b700a6 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_range.h b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_range.h
index 2171247e0c..eac13ce9ac 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_range.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_range.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_function_exec_non_removable.h"
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_test.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_test.cpp
index 960d21877c..f1a552a74c 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_test.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_non_removable_test.cpp
@@ -30,12 +30,12 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.h b/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.h
index 0c716f47c5..ff66dfec7d 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_removable_document.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_removable_range.h b/src/mongo/db/pipeline/window_function/window_function_exec_removable_range.h
index d3c295faae..a25aae8700 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_removable_range.h
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_removable_range.h
@@ -29,8 +29,8 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_removable_test.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_removable_test.cpp
index b681dea292..6c39882569 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_removable_test.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_removable_test.cpp
@@ -30,11 +30,11 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/exec/document_value/document_value_test_util.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_mock.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/partition_iterator.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function_exec_non_removable.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_expression.cpp b/src/mongo/db/pipeline/window_function/window_function_expression.cpp
index 9146b5d5b7..bcb18f834b 100644
--- a/src/mongo/db/pipeline/window_function/window_function_expression.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_expression.cpp
@@ -29,11 +29,11 @@
 
 #include "mongo/platform/basic.h"
 
-#include "mongo/db/pipeline/accumulation_statement.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_set_window_fields.h"
-#include "mongo/db/pipeline/document_source_set_window_fields_gen.h"
+#include "mongo/db/pipeline/accumulator/accumulation_statement.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields_gen.h"
 #include "mongo/db/pipeline/lite_parsed_document_source.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_expression.h b/src/mongo/db/pipeline/window_function/window_function_expression.h
index 52fe79e5b4..be90ef3055 100644
--- a/src/mongo/db/pipeline/window_function/window_function_expression.h
+++ b/src/mongo/db/pipeline/window_function/window_function_expression.h
@@ -30,10 +30,10 @@
 #pragma once
 
 #include "mongo/base/initializer.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/accumulator_for_window_functions.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_set_window_fields_gen.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator_for_window_functions.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_set_window_fields_gen.h"
 #include "mongo/db/pipeline/window_function/window_bounds.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
 #include "mongo/db/query/datetime/date_time_support.h"
diff --git a/src/mongo/db/pipeline/window_function/window_function_integral.cpp b/src/mongo/db/pipeline/window_function/window_function_integral.cpp
index d38e65d97c..ccc989e159 100644
--- a/src/mongo/db/pipeline/window_function/window_function_integral.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_integral.cpp
@@ -28,7 +28,7 @@
  */
 
 #include "mongo/db/pipeline/window_function/window_function_integral.h"
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_min_max.h b/src/mongo/db/pipeline/window_function/window_function_min_max.h
index 0ff212484c..44d38667c7 100644
--- a/src/mongo/db/pipeline/window_function/window_function_min_max.h
+++ b/src/mongo/db/pipeline/window_function/window_function_min_max.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/window_function/window_function_stddev.h b/src/mongo/db/pipeline/window_function/window_function_stddev.h
index 5b4aa45b07..f79a2affda 100644
--- a/src/mongo/db/pipeline/window_function/window_function_stddev.h
+++ b/src/mongo/db/pipeline/window_function/window_function_stddev.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulator.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
 
 namespace mongo {
diff --git a/src/mongo/db/pipeline/window_function/window_function_sum.cpp b/src/mongo/db/pipeline/window_function/window_function_sum.cpp
index 9f188184ee..fd39d189bb 100644
--- a/src/mongo/db/pipeline/window_function/window_function_sum.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_sum.cpp
@@ -29,9 +29,9 @@
 
 #include "mongo/db/pipeline/window_function/window_function_sum.h"
 
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/pipeline/window_function/window_function_sum.h b/src/mongo/db/pipeline/window_function/window_function_sum.h
index 6f4b6bfaca..f391a7e584 100644
--- a/src/mongo/db/pipeline/window_function/window_function_sum.h
+++ b/src/mongo/db/pipeline/window_function/window_function_sum.h
@@ -29,9 +29,9 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/pipeline/window_function/window_function.h"
 
 namespace mongo {
diff --git a/src/mongo/db/query/projection_ast.h b/src/mongo/db/query/projection_ast.h
index 3f68b7ff34..aa1a3ee8dd 100644
--- a/src/mongo/db/query/projection_ast.h
+++ b/src/mongo/db/query/projection_ast.h
@@ -33,7 +33,7 @@
 #include "mongo/db/matcher/copyable_match_expression.h"
 #include "mongo/db/matcher/expression_parser.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/query/projection_ast_visitor.h"
 
 namespace mongo {
diff --git a/src/mongo/db/query/sbe_stage_builder_expression.cpp b/src/mongo/db/query/sbe_stage_builder_expression.cpp
index c282b29705..a20326062f 100644
--- a/src/mongo/db/query/sbe_stage_builder_expression.cpp
+++ b/src/mongo/db/query/sbe_stage_builder_expression.cpp
@@ -44,9 +44,9 @@
 #include "mongo/db/exec/sbe/stages/union.h"
 #include "mongo/db/exec/sbe/values/bson.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/accumulator.h"
-#include "mongo/db/pipeline/expression_visitor.h"
-#include "mongo/db/pipeline/expression_walker.h"
+#include "mongo/db/pipeline/accumulator/accumulator.h"
+#include "mongo/db/pipeline/expression/expression_visitor.h"
+#include "mongo/db/pipeline/expression/expression_walker.h"
 #include "mongo/db/query/projection_parser.h"
 #include "mongo/db/query/sbe_stage_builder_eval_frame.h"
 #include "mongo/util/str.h"
diff --git a/src/mongo/db/query/sbe_stage_builder_expression.h b/src/mongo/db/query/sbe_stage_builder_expression.h
index 54ec37ab96..bfb1eef4d9 100644
--- a/src/mongo/db/query/sbe_stage_builder_expression.h
+++ b/src/mongo/db/query/sbe_stage_builder_expression.h
@@ -33,10 +33,9 @@
 #include "mongo/db/exec/sbe/stages/stages.h"
 #include "mongo/db/exec/sbe/values/value.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 #include "mongo/db/query/sbe_stage_builder_eval_frame.h"
 #include "mongo/db/query/sbe_stage_builder_helpers.h"
-
 namespace mongo::stage_builder {
 /**
  * Translates an input Expression into an SBE EExpression. The 'stage' parameter provides the input
diff --git a/src/mongo/db/query/sort_pattern.h b/src/mongo/db/query/sort_pattern.h
index 1b55472a79..e3230a5587 100644
--- a/src/mongo/db/query/sort_pattern.h
+++ b/src/mongo/db/query/sort_pattern.h
@@ -32,7 +32,7 @@
 
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/pipeline/document_path_support.h"
-#include "mongo/db/pipeline/expression.h"
+#include "mongo/db/pipeline/expression/expression.h"
 
 namespace mongo {
 class SortPattern {
diff --git a/src/mongo/db/repl/tenant_migration_util.cpp b/src/mongo/db/repl/tenant_migration_util.cpp
index dd9934c68d..066c83401b 100644
--- a/src/mongo/db/repl/tenant_migration_util.cpp
+++ b/src/mongo/db/repl/tenant_migration_util.cpp
@@ -39,12 +39,12 @@
 #include "mongo/db/logical_time_validator.h"
 #include "mongo/db/ops/update.h"
 #include "mongo/db/ops/update_request.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_graph_lookup.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
 #include "mongo/db/repl/repl_client_info.h"
 #include "mongo/db/repl/repl_server_parameters_gen.h"
 #include "mongo/db/repl/wait_for_majority_service.h"
diff --git a/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h b/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h
index 2917666fee..0d95d86ad0 100644
--- a/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h
+++ b/src/mongo/db/s/resharding/document_source_resharding_iterate_transaction.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 
 namespace mongo {
 
diff --git a/src/mongo/db/s/resharding/resharding_agg_test.cpp b/src/mongo/db/s/resharding/resharding_agg_test.cpp
index b4f6299604..599a54c403 100644
--- a/src/mongo/db/s/resharding/resharding_agg_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_agg_test.cpp
@@ -30,7 +30,7 @@
 #include "mongo/platform/basic.h"
 
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/repl/oplog_entry.h"
 #include "mongo/db/s/resharding/resharding_donor_oplog_iterator.h"
diff --git a/src/mongo/db/s/resharding/resharding_collection_cloner.cpp b/src/mongo/db/s/resharding/resharding_collection_cloner.cpp
index 7d085a3a82..3f74890464 100644
--- a/src/mongo/db/s/resharding/resharding_collection_cloner.cpp
+++ b/src/mongo/db/s/resharding/resharding_collection_cloner.cpp
@@ -44,9 +44,9 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/logical_session_id_helpers.h"
 #include "mongo/db/pipeline/aggregation_request_helper.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/query/query_request_helper.h"
 #include "mongo/db/s/resharding/resharding_data_copy_util.h"
diff --git a/src/mongo/db/s/resharding/resharding_collection_cloner_test.cpp b/src/mongo/db/s/resharding/resharding_collection_cloner_test.cpp
index f47186f8e9..91c20a9f70 100644
--- a/src/mongo/db/s/resharding/resharding_collection_cloner_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_collection_cloner_test.cpp
@@ -37,7 +37,7 @@
 #include "mongo/bson/json.h"
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/hasher.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/s/resharding/resharding_collection_cloner.h"
 #include "mongo/db/s/resharding/resharding_metrics.h"
 #include "mongo/db/s/resharding_util.h"
diff --git a/src/mongo/db/s/resharding/resharding_donor_oplog_iterator.cpp b/src/mongo/db/s/resharding/resharding_donor_oplog_iterator.cpp
index c8a89ab846..43085c9d7a 100644
--- a/src/mongo/db/s/resharding/resharding_donor_oplog_iterator.cpp
+++ b/src/mongo/db/s/resharding/resharding_donor_oplog_iterator.cpp
@@ -39,11 +39,11 @@
 #include "mongo/bson/bsonmisc.h"
 #include "mongo/bson/json.h"
 #include "mongo/db/client.h"
-#include "mongo/db/pipeline/document_source_lookup.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_replace_root.h"
-#include "mongo/db/pipeline/document_source_sort.h"
-#include "mongo/db/pipeline/document_source_unwind.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/pipeline/process_interface/mongo_process_interface.h"
 #include "mongo/db/s/resharding/resharding_server_parameters_gen.h"
 #include "mongo/db/s/resharding_util.h"
diff --git a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
index 958ac58878..a6f3227867 100644
--- a/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_oplog_fetcher_test.cpp
@@ -42,7 +42,7 @@
 #include "mongo/db/dbhelpers.h"
 #include "mongo/db/logical_session_cache_noop.h"
 #include "mongo/db/op_observer_impl.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/repl/storage_interface_impl.h"
 #include "mongo/db/repl/wait_for_majority_service.h"
 #include "mongo/db/s/operation_sharding_state.h"
diff --git a/src/mongo/db/s/resharding/resharding_txn_cloner.cpp b/src/mongo/db/s/resharding/resharding_txn_cloner.cpp
index 161c3ef953..609d7bb19b 100644
--- a/src/mongo/db/s/resharding/resharding_txn_cloner.cpp
+++ b/src/mongo/db/s/resharding/resharding_txn_cloner.cpp
@@ -46,8 +46,8 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/operation_context.h"
 #include "mongo/db/persistent_task_store.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/process_interface/mongo_process_interface.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/repl/optime.h"
diff --git a/src/mongo/db/s/resharding/resharding_util_test.cpp b/src/mongo/db/s/resharding/resharding_util_test.cpp
index f73b88dd76..bd8cfdd328 100644
--- a/src/mongo/db/s/resharding/resharding_util_test.cpp
+++ b/src/mongo/db/s/resharding/resharding_util_test.cpp
@@ -38,7 +38,7 @@
 #include "mongo/db/exec/document_value/document_value_test_util.h"
 #include "mongo/db/hasher.h"
 #include "mongo/db/pipeline/aggregation_context_fixture.h"
-#include "mongo/db/pipeline/document_source_mock.h"
+#include "mongo/db/pipeline/document_source/document_source_mock.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/repl/oplog_entry.h"
 #include "mongo/db/s/config/config_server_test_fixture.h"
diff --git a/src/mongo/db/s/resharding_util.cpp b/src/mongo/db/s/resharding_util.cpp
index 03c6a96dd3..8acc7e4c26 100644
--- a/src/mongo/db/s/resharding_util.cpp
+++ b/src/mongo/db/s/resharding_util.cpp
@@ -42,8 +42,13 @@
 #include "mongo/db/exec/document_value/document.h"
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/document_source_add_fields.h"
-#include "mongo/db/pipeline/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_add_fields.h"
+#include "mongo/db/pipeline/document_source/document_source_graph_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_lookup.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_replace_root.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_unwind.h"
 #include "mongo/db/s/collection_sharding_state.h"
 #include "mongo/db/s/resharding/document_source_resharding_iterate_transaction.h"
 #include "mongo/db/s/sharding_state.h"
diff --git a/src/mongo/db/s/sharding_ddl_coordinator_service.cpp b/src/mongo/db/s/sharding_ddl_coordinator_service.cpp
index 1cbd546a6f..17008ab172 100644
--- a/src/mongo/db/s/sharding_ddl_coordinator_service.cpp
+++ b/src/mongo/db/s/sharding_ddl_coordinator_service.cpp
@@ -35,7 +35,7 @@
 
 #include "mongo/base/checked_cast.h"
 #include "mongo/db/dbdirectclient.h"
-#include "mongo/db/pipeline/document_source_count.h"
+#include "mongo/db/pipeline/document_source/document_source_count.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/s/database_sharding_state.h"
 #include "mongo/db/s/operation_sharding_state.h"
diff --git a/src/mongo/db/update/pipeline_executor.cpp b/src/mongo/db/update/pipeline_executor.cpp
index 2c1f900190..af93d03416 100644
--- a/src/mongo/db/update/pipeline_executor.cpp
+++ b/src/mongo/db/update/pipeline_executor.cpp
@@ -33,7 +33,7 @@
 
 #include "mongo/bson/mutable/document.h"
 #include "mongo/db/bson/dotted_path_support.h"
-#include "mongo/db/pipeline/document_source_queue.h"
+#include "mongo/db/pipeline/document_source/document_source_queue.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/variable_validation.h"
 #include "mongo/db/query/query_feature_flags_gen.h"
diff --git a/src/mongo/db/update/pipeline_executor.h b/src/mongo/db/update/pipeline_executor.h
index e0b16b851c..e11d5bf24c 100644
--- a/src/mongo/db/update/pipeline_executor.h
+++ b/src/mongo/db/update/pipeline_executor.h
@@ -35,7 +35,7 @@
 #include <utility>
 #include <vector>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/update/update_executor.h"
 
diff --git a/src/mongo/db/views/resolved_view.cpp b/src/mongo/db/views/resolved_view.cpp
index 9c754c559e..477c3938ec 100644
--- a/src/mongo/db/views/resolved_view.cpp
+++ b/src/mongo/db/views/resolved_view.cpp
@@ -33,9 +33,9 @@
 
 #include "mongo/base/init.h"
 #include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/pipeline/document_source_index_stats.h"
-#include "mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.h"
-#include "mongo/db/pipeline/document_source_internal_unpack_bucket.h"
+#include "mongo/db/pipeline/document_source/document_source_index_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_convert_bucket_index_stats.h"
+#include "mongo/db/pipeline/document_source/document_source_internal_unpack_bucket.h"
 #include "mongo/db/timeseries/timeseries_constants.h"
 #include "mongo/rpc/get_status_from_command_result.h"
 
diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp
index 9d72eb06d6..0b29f1c452 100644
--- a/src/mongo/db/views/view_catalog.cpp
+++ b/src/mongo/db/views/view_catalog.cpp
@@ -47,7 +47,7 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/operation_context.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/pipeline.h"
diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp
index 79d1d3f847..8e29532206 100644
--- a/src/mongo/dbtests/documentsourcetests.cpp
+++ b/src/mongo/dbtests/documentsourcetests.cpp
@@ -43,8 +43,8 @@
 #include "mongo/db/exec/plan_stage.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
 #include "mongo/db/pipeline/dependencies.h"
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/query/get_executor.h"
diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp
index 5aa5bdcf43..50b33240ea 100644
--- a/src/mongo/dbtests/query_plan_executor.cpp
+++ b/src/mongo/dbtests/query_plan_executor.cpp
@@ -47,7 +47,7 @@
 #include "mongo/db/json.h"
 #include "mongo/db/matcher/expression_parser.h"
 #include "mongo/db/namespace_string.h"
-#include "mongo/db/pipeline/document_source_cursor.h"
+#include "mongo/db/pipeline/document_source/document_source_cursor.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/db/pipeline/plan_executor_pipeline.h"
diff --git a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
index 1a810b73f3..d400ac3467 100644
--- a/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_client_impl.cpp
@@ -45,8 +45,8 @@
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/operation_context.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_union_with.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_union_with.h"
 #include "mongo/db/repl/optime.h"
 #include "mongo/db/repl/read_concern_args.h"
 #include "mongo/db/repl/repl_client_info.h"
diff --git a/src/mongo/s/query/cluster_aggregate.cpp b/src/mongo/s/query/cluster_aggregate.cpp
index b9f68107a4..794a3f3c63 100644
--- a/src/mongo/s/query/cluster_aggregate.cpp
+++ b/src/mongo/s/query/cluster_aggregate.cpp
@@ -41,8 +41,8 @@
 #include "mongo/db/commands.h"
 #include "mongo/db/curop.h"
 #include "mongo/db/operation_context.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_out.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/db/pipeline/pipeline.h"
diff --git a/src/mongo/s/query/cluster_aggregate.h b/src/mongo/s/query/cluster_aggregate.h
index a872aa0ea1..c49b8f086c 100644
--- a/src/mongo/s/query/cluster_aggregate.h
+++ b/src/mongo/s/query/cluster_aggregate.h
@@ -33,7 +33,7 @@
 #include "mongo/bson/bsonobj.h"
 #include "mongo/db/namespace_string.h"
 #include "mongo/db/pipeline/aggregate_command_gen.h"
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/lite_parsed_pipeline.h"
 #include "mongo/s/query/cluster_client_cursor_params.h"
 #include "mongo/s/query/document_source_merge_cursors.h"
diff --git a/src/mongo/s/query/cluster_aggregation_planner.cpp b/src/mongo/s/query/cluster_aggregation_planner.cpp
index a9686f1592..50f4eb59ba 100644
--- a/src/mongo/s/query/cluster_aggregation_planner.cpp
+++ b/src/mongo/s/query/cluster_aggregation_planner.cpp
@@ -36,8 +36,8 @@
 #include "mongo/client/connpool.h"
 #include "mongo/db/auth/authorization_session.h"
 #include "mongo/db/pipeline/change_stream_invalidation_info.h"
-#include "mongo/db/pipeline/document_source_limit.h"
-#include "mongo/db/pipeline/document_source_skip.h"
+#include "mongo/db/pipeline/document_source/document_source_limit.h"
+#include "mongo/db/pipeline/document_source/document_source_skip.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/db/query/find_common.h"
 #include "mongo/logv2/log.h"
diff --git a/src/mongo/s/query/cluster_exchange_test.cpp b/src/mongo/s/query/cluster_exchange_test.cpp
index 22bf973c0c..b4f0a2c57f 100644
--- a/src/mongo/s/query/cluster_exchange_test.cpp
+++ b/src/mongo/s/query/cluster_exchange_test.cpp
@@ -31,12 +31,12 @@
 
 #include "mongo/client/remote_command_targeter_factory_mock.h"
 #include "mongo/client/remote_command_targeter_mock.h"
-#include "mongo/db/pipeline/document_source_group.h"
-#include "mongo/db/pipeline/document_source_match.h"
-#include "mongo/db/pipeline/document_source_merge.h"
-#include "mongo/db/pipeline/document_source_out.h"
-#include "mongo/db/pipeline/document_source_project.h"
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_group.h"
+#include "mongo/db/pipeline/document_source/document_source_match.h"
+#include "mongo/db/pipeline/document_source/document_source_merge.h"
+#include "mongo/db/pipeline/document_source/document_source_out.h"
+#include "mongo/db/pipeline/document_source/document_source_project.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/pipeline/sharded_agg_helpers.h"
 #include "mongo/s/catalog/type_shard.h"
 #include "mongo/s/query/sharded_agg_test_fixture.h"
diff --git a/src/mongo/s/query/document_source_merge_cursors.cpp b/src/mongo/s/query/document_source_merge_cursors.cpp
index 737ad72100..5f0f39c6d3 100644
--- a/src/mongo/s/query/document_source_merge_cursors.cpp
+++ b/src/mongo/s/query/document_source_merge_cursors.cpp
@@ -31,7 +31,7 @@
 
 #include "mongo/s/query/document_source_merge_cursors.h"
 
-#include "mongo/db/pipeline/document_source_sort.h"
+#include "mongo/db/pipeline/document_source/document_source_sort.h"
 #include "mongo/db/query/find_common.h"
 #include "mongo/s/grid.h"
 #include "mongo/s/query/establish_cursors.h"
diff --git a/src/mongo/s/query/document_source_merge_cursors.h b/src/mongo/s/query/document_source_merge_cursors.h
index d79c192d4b..cfda8db03d 100644
--- a/src/mongo/s/query/document_source_merge_cursors.h
+++ b/src/mongo/s/query/document_source_merge_cursors.h
@@ -31,7 +31,7 @@
 
 #include <memory>
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/executor/task_executor.h"
 #include "mongo/s/query/blocking_results_merger.h"
 #include "mongo/s/query/router_stage_merge.h"
diff --git a/src/mongo/s/query/router_stage_pipeline.cpp b/src/mongo/s/query/router_stage_pipeline.cpp
index 4208f8fb25..ba0bf7386e 100644
--- a/src/mongo/s/query/router_stage_pipeline.cpp
+++ b/src/mongo/s/query/router_stage_pipeline.cpp
@@ -31,9 +31,9 @@
 
 #include "mongo/s/query/router_stage_pipeline.h"
 
-#include "mongo/db/pipeline/document_source.h"
-#include "mongo/db/pipeline/document_source_change_stream.h"
-#include "mongo/db/pipeline/document_source_list_local_sessions.h"
+#include "mongo/db/pipeline/change_stream/document_source_change_stream.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source_list_local_sessions.h"
 #include "mongo/db/pipeline/expression_context.h"
 #include "mongo/s/query/document_source_merge_cursors.h"
 
diff --git a/src/mongo/s/query/router_stage_pipeline.h b/src/mongo/s/query/router_stage_pipeline.h
index de0dc25b31..7b295e63b9 100644
--- a/src/mongo/s/query/router_stage_pipeline.h
+++ b/src/mongo/s/query/router_stage_pipeline.h
@@ -31,7 +31,7 @@
 
 #include "mongo/s/query/router_exec_stage.h"
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/pipeline.h"
 #include "mongo/s/query/document_source_merge_cursors.h"
 
diff --git a/src/mongo/s/query/sharded_agg_test_fixture.h b/src/mongo/s/query/sharded_agg_test_fixture.h
index 8fc5a61805..42bcd66acc 100644
--- a/src/mongo/s/query/sharded_agg_test_fixture.h
+++ b/src/mongo/s/query/sharded_agg_test_fixture.h
@@ -29,7 +29,7 @@
 
 #pragma once
 
-#include "mongo/db/pipeline/document_source.h"
+#include "mongo/db/pipeline/document_source/document_source.h"
 #include "mongo/db/pipeline/expression_context_for_test.h"
 #include "mongo/db/pipeline/process_interface/stub_mongo_process_interface.h"
 #include "mongo/s/catalog_cache_test_fixture.h"
