Skip to content

Conversation

matthewdale
Copy link
Collaborator

Summary

Replace all uses of interface{} with any in the "mongo/" packages.

Background & Motivation

any is a type alias for interface{}, so is semantically identical. The only change is a slightly cleaner syntax.

@matthewdale matthewdale requested a review from a team as a code owner July 25, 2025 20:52
@matthewdale matthewdale requested a review from qingyang-hu July 25, 2025 20:52
@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the review-priority-low Low Priority PR for Review: within 3 business days label Jul 25, 2025
Copy link
Contributor

API Change Report

No changes found!

qingyang-hu
qingyang-hu previously approved these changes Aug 5, 2025
qingyang-hu
qingyang-hu previously approved these changes Aug 11, 2025
@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 18:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Replace all uses of interface{} with any in the mongo/ packages to adopt the cleaner syntax introduced in Go 1.18. This is a purely syntactic change with no semantic differences since any is a type alias for interface{}.

  • Replace interface{} with any across all function parameters, return types, struct fields, and variable declarations
  • Update function signatures in the MongoDB driver APIs to use the more modern syntax
  • Maintain full backward compatibility as this is only a type alias change

Reviewed Changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mongo/writeconcern/writeconcern.go Update WriteConcern struct field type
mongo/with_transactions_test.go Update transaction callback function signatures
mongo/single_result.go Update function parameters and return types
mongo/session.go Update WithTransaction method signature
mongo/search_index_view.go Update struct fields and method parameters
mongo/results.go Update result struct field types
mongo/options/ (multiple files) Update option struct fields and method parameters across all option builders
mongo/mongo.go Update core marshal/unmarshal function signatures
mongo/index_view.go Update IndexModel struct and method parameters
mongo/gridfs/ (multiple files) Update GridFS-related types and method signatures
mongo/errors.go Update MarshalError struct field type
mongo/doc.go Update documentation comments
mongo/database.go Update database method parameters
mongo/cursor.go Update cursor method signatures
mongo/collection.go Update collection method parameters and internal types
mongo/client.go Update client method parameters and struct fields
mongo/change_stream.go Update change stream related types
mongo/bulk_write.go Update bulk write related types and method signatures
mongo/batch_cursor.go Update interface method signature
mongo/background_context.go Update context method signature

@matthewdale matthewdale enabled auto-merge (squash) August 11, 2025 18:53
Copy link
Contributor

🧪 Performance Results

Commit SHA: 3f726df

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

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkBSONFullDocumentDecoding ops_per_second_min -18.9870 1496.7080 Avg: 1847.4902
Med: 1863.1689
Stdev: 89.9332
0.8615 -3.9005
BenchmarkSingleFindOneByID total_mem_allocs -8.2310 1527211.0000 Avg: 1664189.9835
Med: 1672549.0000
Stdev: 66349.6300
0.7285 -2.0645
BenchmarkSingleFindOneByID ops_per_second_med -6.3628 3858.5457 Avg: 4120.7410
Med: 4139.2787
Stdev: 104.9667
0.7837 -2.4979
BenchmarkSingleFindOneByID ns_per_op 6.3223 264990.0000 Avg: 249232.6648
Med: 248098.0000
Stdev: 6923.5126
0.7626 2.2759
BenchmarkBSONFlatDocumentDecoding ns_per_op 4.6938 60789.0000 Avg: 58063.5882
Med: 57529.0000
Stdev: 940.4172
0.8209 2.8981
BenchmarkBSONFlatDocumentDecoding ops_per_second_med -4.0944 17686.2808 Avg: 18441.3404
Med: 18569.0676
Stdev: 249.9822
0.8220 -3.0205
BenchmarkBSONFullDocumentDecoding ns_per_op 4.0939 86828.0000 Avg: 83413.1765
Med: 82985.0000
Stdev: 1331.7818
0.7990 2.5641
BenchmarkBSONFlatDocumentDecoding total_mem_allocs -4.0076 9078272.0000 Avg: 9457278.1765
Med: 9521237.0000
Stdev: 165236.3578
0.7646 -2.2937
BenchmarkBSONFlatDocumentDecoding total_bytes_allocated -4.0011 356921736.0000 Avg: 371797583.0588
Med: 374313240.0000
Stdev: 6484310.8525
0.7647 -2.2941
BenchmarkBSONFullDocumentDecoding ops_per_second_med -3.8359 12371.8738 Avg: 12865.3792
Med: 12891.0832
Stdev: 163.0986
0.8259 -3.0258
BenchmarkBSONFullDocumentDecoding total_mem_allocs -3.6707 8474307.0000 Avg: 8797231.1765
Med: 8826864.0000
Stdev: 137538.3629
0.7784 -2.3479
BenchmarkBSONFlatDocumentDecoding ops_per_second_max -3.2822 18552.5315 Avg: 19182.1303
Med: 19205.6541
Stdev: 225.3584
0.8066 -2.7938
BenchmarkSingleFindOneByID allocated_bytes_per_op 0.8868 22392.0000 Avg: 22195.1765
Med: 22179.0000
Stdev: 57.4807
0.8890 3.4242
BenchmarkBSONDeepDocumentDecoding allocated_bytes_per_op -0.0650 15094.0000 Avg: 15103.8235
Med: 15104.0000
Stdev: 0.5286
0.9760 -18.5843
BenchmarkBSONFlatDocumentDecoding allocated_bytes_per_op 0.0075 18047.0000 Avg: 18045.6471
Med: 18046.0000
Stdev: 0.6063
0.7801 2.2313

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

@matthewdale matthewdale merged commit 21ab64f into mongodb:master Aug 11, 2025
9 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 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