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-2243 Wrap write errors in IndexView.CreateMany #820

Merged
merged 1 commit into from Dec 1, 2021

Conversation

reillywatson
Copy link
Contributor

This was returning driver.ErrUnacknowledgedWrite when creating indexes with an unacknowledged WriteConcern.

Wrap the error using processWriteError so we can return mongo.ErrUnacknowledgedWrite.

This was returning driver.ErrUnacknowledgedWrite when creating indexes with an unacknowledged WriteConcern.

Wrap the error using processWriteError so we can return mongo.ErrUnacknowledgedWrite.
Copy link
Contributor

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

This change makes sense to me! Good catch. Thanks so much for your contribution, @reillywatson. Failing test is due to GODRIVER-2242.

_, err := mt.Coll.Indexes().CreateOne(mtest.Background, mongo.IndexModel{Keys: bson.D{{"x", 1}}})
if err != mongo.ErrUnacknowledgedWrite {
// Use a direct comparison rather than assert.Equal because assert.Equal will compare the error strings,
// so the assertion would succeed even if the error had not been wrapped.
Copy link
Contributor

Choose a reason for hiding this comment

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

Helpful comment, thank you!

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 👍

@matthewdale matthewdale merged commit 52614f9 into mongodb:master Dec 1, 2021
faem pushed a commit to kubedb/mongo-go-driver that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants