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-3499 Update v2 migration guide. #1987

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

qingyang-hu
Copy link
Collaborator

GODRIVER-3499

Summary

Update the v2 migration guide on ClientOptions.AuthenticateToAnything and ArrayFilters.

Background & Motivation

@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added documentation Pull requests that update documentation or examples priority-3-low Low Priority PR for Review labels Mar 12, 2025
Copy link
Contributor

API Change Report

No changes found!

### UpdateManyOptions / UpdateOneOptions

The `UpdateOptions` has been separated into `UpdateManyOptions` and `UpdateOneOptions` to configure the corresponding `UpdateMany` and `UpdateOne` operations.

The data type of `ArrayFilters` in the `Update*Options` has been changed to `[]interface{}`, which can be used as the `Filters` field in the original `ArrayFilters` struct.
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the * in Update*Options? is this meant to be regex? i suggest we simply write out "UpdateManyOptions and UpdateOneOptions" to avoid extra confusion.

also is there a word missing after "the Update*Options"? should it be "the Update*Options types"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The UpdateManyOptions and UpdateOneOptions in v2 are derived from the UpdateOptions in v1, so the ArrayFilters field in both types is also adopted from UpdateOptions. I'm not sure if using "UpdateManyOptions and UpdateOneOptions" is clear enough in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand. What does Update*Options refer to in your statement above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you think the following is clearer?

Suggested change
The data type of `ArrayFilters` in the `Update*Options` has been changed to `[]interface{}`, which can be used as the `Filters` field in the original `ArrayFilters` struct.
The `ArrayFilters` struct type has been removed in v2. Correspondingly, the data type of `ArrayFilters` in the `UpdateOptions` struct has been changed to `[]interface{}` in the `UpdateManyOptions` and `UpdateOneOptions` structs. The new `ArrayFilters` field (with the `[]interface{}` type) can be used as the `Filters` field in the original `ArrayFilters` struct.

Copy link
Contributor

Choose a reason for hiding this comment

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

I looked up the code change and see what you mean now. What made this confusing is that both the field and the struct type had the same name.

How about this:

Suggested change
The data type of `ArrayFilters` in the `Update*Options` has been changed to `[]interface{}`, which can be used as the `Filters` field in the original `ArrayFilters` struct.
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` fields in the new `UpdateManyOptions` and `UpdateOneOptions` structs (which replace the old `UpdateOptions` struct) now use the `[]interface{}` type. The `ArrayFilters` field (now of type `[]interface{}`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.

@@ -633,10 +633,14 @@ The following types are not valid for a `findOne` operation and have been remove
- `MaxAwaitTime`
- `NoCursorTimeout`

The data type of `ArrayFilters` has been changed to `[]interface{}`, which can be used as the `Filters` field in the original `ArrayFilters` struct.
Copy link
Contributor

Choose a reason for hiding this comment

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

would "and" possibly make more sense that "which" here? will defer to @matthewdale

Copy link
Contributor

@jtazin jtazin Mar 14, 2025

Choose a reason for hiding this comment

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

This one should be similar to the one below right?

Suggested change
The data type of `ArrayFilters` has been changed to `[]interface{}`, which can be used as the `Filters` field in the original `ArrayFilters` struct.
The `ArrayFilters` struct type has been removed in v2. As a result, the `ArrayFilters` field in the `FindOneAndUpdateOptions` struct now uses the `[]interface{}` type. The `ArrayFilters` field (now of type `[]interface{}`) serves the same purpose as the `Filters` field in the original `ArrayFilters` struct.

Should we change this section to "### FindOneOptions / FindOneAndUpdateOptions"?

@qingyang-hu qingyang-hu requested a review from jtazin March 14, 2025 22:59
Copy link
Contributor

@jtazin jtazin left a comment

Choose a reason for hiding this comment

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

LGTM - thanks, @qingyang-hu!

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@qingyang-hu qingyang-hu merged commit 9c23d50 into mongodb:master Mar 17, 2025
30 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests that update documentation or examples priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants