-
-
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
Nested Date
type attributes are saved differently at different levels
#7575
Comments
Thanks for opening this issue!
|
I was able to reproduce the issue. Would you want to open a PR with a failing test? I classified this as bug with severity S3 (normal):
|
I suspect this is more of a JS SDK issue. According to the REST documentation, Parse treats
{
"__type": "Date",
"iso": "2022-01-01T12:23:45.678Z"
} So the outcome of "prop2": {
"test": {
"date": {
"__type": "Date",
"iso": "2021-09-14T14:50:37.303Z"
}
}
} My explanation #8001 (comment) may provide some more context on what the JS SDK should be doing. From your current post it seems the JS SDK is partially encoding date correctly, but not handling date correctly on top level dates (i.e. I suspect the issue is here in the JS SDK: https://github.com/parse-community/Parse-SDK-JS/blob/e2bd6be145f55fab322633a8f144be34e7fcb202/src/encode.js#L62-L67. If you add an if statement to check if the current top level object is a date and use a similar block transforming the date to the iso format, it should fix this issue. |
🎉 This change has been released in version 6.0.0-alpha.15 |
🎉 This change has been released in version 6.0.0-beta.1 |
🎉 This change has been released in version 6.0.0 |
New Issue Checklist
Issue Description
If we try to create an object with below code
This is how the saved object in mongo DB looks like
prop2.test.date
is saved as JSON object instead of$date
object whileprop3.date
is properly saved.This breaks date queries
Steps to reproduce
Actual Outcome
Expected Outcome
Environment
Server
4.10.3
Mac OS
Local
Database
MongoDB
4.4.4
Local
Client
Javascript
3.3.0
Old issue related to this #6840
The text was updated successfully, but these errors were encountered: