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

Return command error from findAndModify #2646

Merged
merged 17 commits into from
May 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unused code
  • Loading branch information
chilagrow committed May 18, 2023
commit 9222059c5253d6a12afc79c11ed545fcc5c7dfac
12 changes: 3 additions & 9 deletions integration/findandmodify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ func TestFindAndModifyErrors(t *testing.T) {
t.Parallel()

for name, tc := range map[string]struct { //nolint:vet // it is used for test only
command bson.D
findAndModify string // optional, defaults to "findAndModify"
provider shareddata.Provider // optional, default uses shareddata.ArrayDocuments
command bson.D
provider shareddata.Provider // optional, default uses shareddata.ArrayDocuments

err *mongo.CommandError
altMessage string
Expand Down Expand Up @@ -399,12 +398,7 @@ func TestFindAndModifyErrors(t *testing.T) {

ctx, collection := setup.Setup(t, provider)

findAndModify := "findAndModify"
if tc.findAndModify != "" {
findAndModify = tc.findAndModify
}

command := bson.D{{findAndModify, collection.Name()}}
command := bson.D{{"findAndModify", collection.Name()}}
command = append(command, tc.command...)
if command.Map()["sort"] == nil {
command = append(command, bson.D{{"sort", bson.D{{"_id", 1}}}}...)
Expand Down