-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: Use getters to sync BulkWriteResult wrappers #2716
Conversation
Adds getters so that mergeBatchResults changes are reflected in wrapper classes. NODE-3055
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 mod the typo in the test name
test/functional/insert.test.js
Outdated
@@ -2583,4 +2584,45 @@ describe('Insert', function () { | |||
}); | |||
} | |||
}); | |||
|
|||
it('MongoBulkWriteError.insertedCount should respect BulkWriteResult.insertedCount should respect BulkWrite.nInserted', function () { |
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.
it('MongoBulkWriteError.insertedCount should respect BulkWriteResult.insertedCount should respect BulkWrite.nInserted', function () { | |
it('MongoBulkWriteError.insertedCount should respect BulkWrite.nInserted', function () { |
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'll give this a better name but this was actually correct MongoBulkWriteError
holds a BulkWriteResult
which holds the BulkWrite
so this test makes sure the values thread correctly through the two wrapping classes
I mentioned in stand-up being concerned about printing these classes out being changed, so to follow up Here's what it looks like on this fix: {
name: 'MongoBulkWriteError',
code: 11000,
writeErrors: [ WriteError { err: [Object] } ],
result: BulkWriteResult {
result: {
ok: 1,
writeErrors: [Array],
writeConcernErrors: [],
insertedIds: [Array],
nInserted: 2,
nUpserted: 0,
nMatched: 0,
nModified: 0,
nRemoved: 0,
upserted: []
}
}
} Version 3.6 {
driver: true,
code: 11000,
writeErrors: [ WriteError { err: [Object] } ],
result: BulkWriteResult {
result: {
ok: 1,
writeErrors: [Array],
writeConcernErrors: [],
insertedIds: [Array],
nInserted: 2,
nUpserted: 0,
nMatched: 0,
nModified: 0,
nRemoved: 0,
upserted: []
}
}
} Essentially the same and it contains the information you would most likely be looking for |
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
Adds getters so that mergeBatchResults changes are reflected in wrapper classes. NODE-3055
Adds getters so that mergeBatchResults changes are reflected in wrapper
classes.
NODE-3055
Came across this bug while working on unified tests, these properties are new in 4.0 so this doesn't need a backport.