-
Notifications
You must be signed in to change notification settings - Fork 897
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-3285 Allow sort option in client bulk write. #1923
base: master
Are you sure you want to change the base?
GODRIVER-3285 Allow sort option in client bulk write. #1923
Conversation
API Change Report./v2/mongocompatible changes(*ClientReplaceOneModel).SetSort: added |
ada2a32
to
24db535
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with documentation updates
mongo/client_bulk_write_models.go
Outdated
@@ -105,6 +106,14 @@ func (uom *ClientUpdateOneModel) SetUpsert(upsert bool) *ClientUpdateOneModel { | |||
return uom | |||
} | |||
|
|||
// SetSort specifies which document the operation updates if the query matches multiple documents. The first document | |||
// matched by the sort order will be updated. This option is only valid for MongoDB versions >= 8.0. The driver will | |||
// return an error if the sort parameter is a multi-key map. The default value is nil. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest clarifying this sentence:
The driver will return an error if the sort parameter is a multi-key map.
Note that the sort parameter cannot be an unordered since different orders mean different things. Specifically, when sorting on multiple fields, sort order is evaluated from left to right.
Because sort order matters (evaluating left to right), the driver will return an error if the sort parameter is a multi-key map to prevent unintentional behavior.
SetSort for ClientReplaceOneModel also needs to be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will update the comment for findoptions
, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
GODRIVER-3285
Summary
Allow sort option in
UpdateOne
andRepleaceOne
in client bulk write.Background & Motivation
Collection bulk write has been done in #1797