Skip to content

GODRIVER-3890 Move aggregate to the mongo package.#2478

Open
matthewdale wants to merge 2 commits into
mongodb:masterfrom
matthewdale:godriver3890-move-aggregate
Open

GODRIVER-3890 Move aggregate to the mongo package.#2478
matthewdale wants to merge 2 commits into
mongodb:masterfrom
matthewdale:godriver3890-move-aggregate

Conversation

@matthewdale

@matthewdale matthewdale commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

GODRIVER-3890

Summary

Move the aggregate operation logic from the x/mongo/driver/operation package to the mongo package, removing the unnecessary chainable setters. Don't export the moved types.

Background & Motivation

Part of a larger effort to reduce unnecessary code by removing the x/mongo/driver/operation package.

@mongodb-drivers-pr-bot

Copy link
Copy Markdown
Contributor

API Change Report

./v2/x/mongo/driver/operation

incompatible changes

Aggregate: removed
NewAggregate: removed

@mongodb-drivers-pr-bot

mongodb-drivers-pr-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🧪 Performance Results

Commit SHA: 46227b3

The following benchmark tests for version 6a55a900cfb66200078dfb56 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkMultiInsertSmallDocument ns_per_op 6.5896 6749.0000 Avg: 6331.7650
Med: 6325.0000
Stdev: 170.2519
0.7854 2.4507
BenchmarkMultiFindMany ops_per_second_med -2.7696 3649635.0365 Avg: 3753595.5644
Med: 3745318.3521
Stdev: 40933.7167
0.7908 -2.5397

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are redundant with the TestCollection/aggregate integration tests.

@matthewdale matthewdale added review-priority-low Low Priority PR for Review: within 3 business days ignore-for-release labels Jul 10, 2026
@matthewdale matthewdale marked this pull request as ready for review July 10, 2026 19:43
@matthewdale matthewdale requested a review from a team as a code owner July 10, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the low-level aggregate command construction/execution logic out of x/mongo/driver/operation into the public mongo package as an unexported operation type, and updates call sites to build the operation via struct literals rather than chainable setters.

Changes:

  • Deleted x/mongo/driver/operation.Aggregate and introduced an unexported mongo.aggregateOp.
  • Updated Collection aggregate/count and ChangeStream code paths to use aggregateOp directly.
  • Removed the x/mongo/driver/integration aggregate integration test and an unused test helper.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
x/mongo/driver/operation/aggregate.go Removed the old exported Aggregate operation implementation.
x/mongo/driver/integration/main_test.go Removed autoInsertDocs helper that was only used by the deleted aggregate integration test.
x/mongo/driver/integration/aggregate_test.go Removed integration tests that exercised operation.Aggregate directly.
mongo/op_aggregate.go Added unexported aggregateOp implementation in the mongo package.
mongo/collection.go Switched aggregate/count code paths to instantiate/configure aggregateOp via struct literals/field assignment.
mongo/change_stream.go Switched change stream aggregate execution to use *aggregateOp instead of *operation.Aggregate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mongo/op_aggregate.go Outdated
matthewdale and others added 2 commits July 13, 2026 20:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@matthewdale matthewdale force-pushed the godriver3890-move-aggregate branch from 4c831f2 to 46227b3 Compare July 14, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release review-priority-low Low Priority PR for Review: within 3 business days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants