GODRIVER-3890 Move aggregate to the mongo package.#2478
Conversation
API Change Report./v2/x/mongo/driver/operationincompatible changesAggregate: removed |
🧪 Performance ResultsCommit SHA: 46227b3The following benchmark tests for version 6a55a900cfb66200078dfb56 had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
There was a problem hiding this comment.
These tests are redundant with the TestCollection/aggregate integration tests.
There was a problem hiding this comment.
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.Aggregateand introduced an unexportedmongo.aggregateOp. - Updated
Collectionaggregate/count andChangeStreamcode paths to useaggregateOpdirectly. - Removed the
x/mongo/driver/integrationaggregate 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
4c831f2 to
46227b3
Compare
GODRIVER-3890
Summary
Move the aggregate operation logic from the
x/mongo/driver/operationpackage to themongopackage, 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/operationpackage.