-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add batchUpsert method to data service case API #680
Conversation
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.
nice!
res: Response, | ||
): Promise<void> => { | ||
try { | ||
const toBeUpsertedCaseIds = await findCaseIdsWithCaseReferenceData(req); |
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.
if this still isn't as fast as you want, in theory you could have this fn add the ids to the requests, so that below you don't have to re-filter? (assuming that's even an option in mongodb's bulkwrite fn)
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.
Meaning to perform the updateOne()'s specifying the _id, rather than the caseRef data pair?
I think that's a solid idea. I'm a little worried about this step being generally slow, but plan to test and make these kinds of tweaks in the subsequent change.
Primary goal here is to make the bulk upsert MongoDB invocation more efficient.
In pursuit of avoiding a super large/dense PR, I'm cutting this at what's sort of an intermediate state. Rather than expose this endpoint directly in a subsequent PR, I'll probably wrap it together with the existing batchValidate method before doing so (in that same PR). Happy to hear thoughts on this.