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

fix(db): only callback with MongoError NODE-1293 #1652

Merged
merged 3 commits into from
Jan 29, 2018
Merged

Conversation

jlord
Copy link
Contributor

@jlord jlord commented Jan 26, 2018

If an error occurs within the users callback the callback is called twice. This checks and only returns the callback with an error if it is a MongoError from the server.

Fixes NODE-1293

@jlord jlord requested a review from mbroadst January 26, 2018 00:24
@mbroadst
Copy link
Member

@jlord please include a test for this

@jlord
Copy link
Contributor Author

jlord commented Jan 26, 2018

The test that was failing after this change turned out to be a bad test that was expecting an error when it shouldn't have and the error that was actually coming through (and making the test pass previously) was an assertion error from the testing library.

@mbroadst I changed the test to expect error to be null because, if I'm understanding strict = false correctly, no error should be returned if there isn't an collection per: https://github.com/mongodb/node-mongodb-native/blob/3.0.0/lib/db.js#L409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants