Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-2367 Un-export all result type BSON encoding logic #1442

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

prestonvasquez
Copy link
Collaborator

GODRIVER-2367

Summary

Remove the mongo.UpdateResult.UnmarshalBSON function and remove the BSON struct tags from mongo.DeleteResult. Additionally, remove other result types support unmarshaling from BSON via an exported UnmarshalBSON function:

  • mongo.CollectionSpecification
  • mongo.IndexSpecification
  • gridfs.File

Background & Motivation

The BSON unmarshaling logic occasionally deviates from the logic used to construct result types in the operation layer. The capability to directly unmarshal from BSON seems to be a remnant from a previous version of the driver, predating the CRUD spec tests.

In principle, this change could be disruptive because some users might unintentionally rely on the decoding logic being removed in this pull request. However, it's worth noting that none of the unmarshal behavior being removed is symmetrical. In other words, there are no encoders available for any of the result data. Consequently, the use of unmarshal is limited to users who are manually encoding the result data themselves, which is a complex and therefore infrequent practice.

@prestonvasquez prestonvasquez requested a review from a team as a code owner October 30, 2023 23:45
@prestonvasquez prestonvasquez requested review from blink1073 and qingyang-hu and removed request for a team October 30, 2023 23:45
@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

./mongo

incompatible changes

(*CollectionSpecification).UnmarshalBSON: removed
(*IndexSpecification).UnmarshalBSON: removed
(*UpdateResult).UnmarshalBSON: removed

./mongo/gridfs

incompatible changes

(*File).UnmarshalBSON: removed

blink1073
blink1073 previously approved these changes Oct 31, 2023
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@qingyang-hu qingyang-hu left a comment

Choose a reason for hiding this comment

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

It's good to merge as long as we update the comment.

Copy link
Collaborator

@qingyang-hu qingyang-hu left a comment

Choose a reason for hiding this comment

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

👍

@prestonvasquez prestonvasquez merged commit 3a339ac into mongodb:master Nov 9, 2023
32 of 37 checks passed
@prestonvasquez prestonvasquez deleted the GODRIVER-2367 branch November 9, 2023 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants