[Fix] Columns of type "Object" merging with old value on Postgres#4815
[Fix] Columns of type "Object" merging with old value on Postgres#4815flovilmart merged 1 commit intoparse-community:masterfrom jaeggerr:fixes/postgres
Conversation
… behaviour as MongoDB (#4808)
Codecov Report
@@ Coverage Diff @@
## master #4815 +/- ##
==========================================
- Coverage 92.82% 92.68% -0.14%
==========================================
Files 119 119
Lines 8684 8684
==========================================
- Hits 8061 8049 -12
- Misses 623 635 +12
Continue to review full report at Codecov.
|
flovilmart
left a comment
There was a problem hiding this comment.
LGTM! Tests pass which is amazing!
| }) | ||
| }); | ||
|
|
||
| it ('Update object field should store exactly same sent object', async (done) => { |
There was a problem hiding this comment.
Using async/await, there’s no need for done as a param and call at the end of the method
|
@flovilmart I think more test are needed for this. See as getting rid of COALESE doesn’t change anything here. The use of ‘unset’ is a workaround. Also {} merged with { c: “d” } is the same as {} updated to { c: “d” } |
|
@dplewis, are you able to write a failing test? The unset, because not saved after I believe has no effect? |
|
@flovilmart Here is the failing test per #4808 (comment) The unset here looks weird to me. Also COALESE is just to prevent null values don't see how that fixes this. |
|
Uhm ok. Not a PG expert. I assumed the test was failing before te fix :) |
|
I am not a PG expert neither but I did not just remove the COALESE but I replaced As far as I understand, it will take the previously stored value or {} if it is null. |
|
@jaeggerr Just ran a few more tests looks right. So {} gets set then you add and remove from it right? |
… behaviour as MongoDB (parse-community#4808) (parse-community#4815)
After this discussion #4808
The PR fixes an issue with Postgres due to this commit #2984.
When updating a field of type object (JSON object), the previous and new values are merged.
This is not the expected behaviour as it is not documented and not happening in MongoDB.