-
Notifications
You must be signed in to change notification settings - Fork 0
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
Remove usage of deprecated database.writeOptions
.
#51
Conversation
update.$setOnInsert = { | ||
'meta.created': now, | ||
'acquisition.acquirerId': acquirerId | ||
}; | ||
} else { | ||
dbOptions = database.writeOptions; |
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 can't remember if the above works or not, i.e., if it behaves the same whether we bring in all of the options manually and layer upsert
on top or if we can just pass upsert
and it will auto-layer it onto the existing options. I know at some point this didn't work, but I'm hopeful it does now. If someone could hack into the code (down deep in the mongodb driver layer) and print out what it does to confirm that it's the same, that would be ideal.
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.
@dlongley Here's what the options look like when it gets to mongodb:
https://gist.github.com/JSAssassin/09b25aa872baadcaa677438f7a88ae5c#file-finaloptions_mongodb_updateone-md
Looks the same except forceServerObjectId
is missing from the one where we only pass upsert.
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.
Thanks, being able to see the differences is excellent. I was mostly concerned about writeConcern
being the same -- and other than some WriteConcern
wrapper being used in some cases, it looks the same, so I presume we're good there. We don't do anything special with _id
... so I don't think we need to worry about forceServerObjectId
either way. This looks good, thank you!
@@ -93,7 +93,7 @@ export async function bulkInsert({restrictions} = {}) { | |||
const meta = {created: now, updated: now}; | |||
let records = restrictions.map(restriction => ({restriction, meta})); | |||
// allow unordered writes | |||
const writeOptions = {...database.writeOptions, ordered: false}; | |||
const writeOptions = {ordered: false}; |
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.
Same comment here as above.
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.
c4781d4
to
f96dac1
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #51 +/- ##
==========================================
- Coverage 90.44% 90.43% -0.02%
==========================================
Files 6 6
Lines 1382 1380 -2
==========================================
- Hits 1250 1248 -2
Misses 132 132
|
Addresses #19