-
-
Notifications
You must be signed in to change notification settings - Fork 4.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] Columns of type "Object" merging with old value on Postgres #4815
Conversation
… behaviour as MongoDB (parse-community#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.
|
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! Tests pass which is amazing!
@@ -1980,4 +1980,31 @@ describe('Parse.Object testing', () => { | |||
done(); | |||
}) | |||
}); | |||
|
|||
it ('Update object field should store exactly same sent object', async (done) => { |
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.
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.