-
Notifications
You must be signed in to change notification settings - Fork 58
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 bulk update with bool field #240
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.
thanks for this! a small change request
Codecov Report
@@ Coverage Diff @@
## master #240 +/- ##
=====================================
Coverage 0% 0%
=====================================
Files 43 43
Lines 1502 1502
=====================================
Misses 1502 1502
Continue to review full report at Codecov.
|
I think there might be more to this fix in that the new code doesn't work with nested data. Looking into it... |
you mean a list inside a data.frame? |
Yes, running |
right, the update fxn is a little different as we need to set the id to null and set the doc as upsert field |
if no test, can you at least show an example here with nested data |
My latest (hopefully final) commit should fix this. I think you actually need
The new {"update":{"_index":"events","_type":"events","_id":"f9dd4b9105a8076c23d998897906e95f8dad33ee"}}
{"doc":{"title":"CCB Safety Training","event_instances":[{"all_day":null,"dt":"2017-12-20 14:00:00 -0400","end_dt":null,"location_text":null}]},"doc_as_upsert":true}
{"update":{"_index":"events","_type":"events","_id":"6b54d6f20c1b4c047658f4b3c78daf6dca81b6a6"}}
{"doc":{"title":"Frankenreads","event_instances":[{"all_day":false,"dt":"2018-10-31 09:00:00 -0400","end_dt":"2018-10-31 16:00:00 -0400","location_text":"Houghton Library, Edison and Newman Room\nQuincy St. & Harvard St., Cambridge"}]},"doc_as_upsert":true}
{"update":{"_index":"events","_type":"events","_id":"42df3e4c8e743e927531f31d9ecd203e5bdb505e"}}
{"doc":{"title":"Nine Moments for Now","event_instances":[{"all_day":false,"dt":"2018-10-31 10:00:00 -0400","end_dt":"2018-10-31 17:00:00 -0400","location_text":"The Ethelbert Cooper Gallery of African and African American Art\n102 Mount Auburn St.\nCambridge"},{"all_day":false,"dt":"2018-11-01 10:00:00 -0400","end_dt":"2018-11-01 17:00:00 -0400","location_text":"The Ethelbert Cooper Gallery of African and African American Art\n102 Mount Auburn St.\nCambridge"},{"all_day":false,"dt":"2018-11-02 10:00:00 -0400","end_dt":"2018-11-02 17:00:00 -0400","location_text":"The Ethelbert Cooper Gallery of African and African American Art\n102 Mount Auburn St.\nCambridge"},{"all_day":false,"dt":"2018-11-03 10:00:00 -0400","end_dt":"2018-11-03 17:00:00 -0400","location_text":"The Ethelbert Cooper Gallery of African and African American Art\n102 Mount Auburn St.\nCambridge"}]},"doc_as_upsert":true} This should work recursively for any level of nested data. |
Maybe a reproducible example? Did you actually test this code? if you install the package on your branch, then use it, it can't find make sure to test it pleae |
I should have some time this week to write some unit tests. Will add to this pull req. |
any thoughts @dpmccabe ? |
Sorry for going silent. I'll add some unit tests to this PR by this weekend. |
thanks |
Unit test added (and passing). |
thanks, having a look |
LGTM |
Fixes #239: In
docs_bulk_update
boolean fields get cast as strings. Just need to runas.list
on each data.frame row, not on the entire data.frame.