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

NODE 1155 - ignoreUndefined is not working in unordered bulkWrite #1550

Merged
merged 6 commits into from Oct 18, 2017

Conversation

jlord
Copy link
Contributor

@jlord jlord commented Oct 18, 2017

This adds the check into unordered bulk operations to see if the ignoreUndefined option has been set to true.

Tests added for both ordered and unordered bulk operations.

Fixes NODE-1155

@jlord jlord requested a review from mbroadst October 18, 2017 15:21
}
});

it('should ignore undefined values in ordered bulk operation if `ignoreUndefined` specified', {
Copy link
Member

Choose a reason for hiding this comment

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

+1 for adding the test for the ordered bulk op too!

.initializeOrderedBulkOp({ ignoreUndefined: true })
.insert({ a: 1, b: undefined })
.execute()
.then(() => col.find({}).toArray())
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: we can use findOne instead of find({}).toArray() to return a single document - I don't think we need to change this, but just consider it in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah 👍

@@ -502,7 +502,7 @@ var executeCommands = function(self, callback) {
finalOptions.serializeFunctions = true;
}

// Serialize functions
// Ingore undefined
Copy link
Member

Choose a reason for hiding this comment

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

Ignore not Ingore, see: Muphry's law

@mbroadst
Copy link
Member

@jlord looks like the tests are failing because those two tests use the same collection name, and never drop the collection between runs resulting in a duplicate key error on the second insert attempt.

@mbroadst mbroadst merged commit 80ed7c8 into 3.0.0 Oct 18, 2017
@mbroadst mbroadst deleted the node-1155 branch October 18, 2017 18:51
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