-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: manual
-
Labels:None
The JSON parser will support parsing ISODates as of SERVER-11814. However, there are some caveats as to what we can parse currently.
Here's the specification (see time_support_test.cpp for the source of this information)
UTC Dates. These are dates that the user is giving to us in UTC, and thus do not need time zone
adjustment. This is signalled by the "Z" at the end.
Allowed date format:
YYYY-MM-DDTHH:MM[:SS[.m[m[m]]]]Z
Year, month, day, hour, and minute are required, while the seconds component and one to three milliseconds are optional.
Examples:
1971-02-03T04:05:06.789Z 1971-02-03T04:05:06.78Z 1971-02-03T04:05:06.7Z 1971-02-03T04:05:06Z 1971-02-03T04:05Z 1970-01-01T00:00:00.000Z 1970-06-30T01:06:40.981Z 2013-02-20T18:29:11.100Z
Only on systems where time_t is large enough:
2058-02-20T18:29:11.100Z
UTC Dates. These are dates that the user is giving to us in local time, and thus do need time zone adjustment. The adjustment is specified by the offset at the end.
Allowed date format:
YYYY-MM-DDTHH:MM[:SS[.m[m[m]]]]+|-HHMM
Year, month, day, hour, and minute are required, while the seconds component and one to three milliseconds are optional. The time zone offset must be four digits.
1971-02-03T09:16:06.789+0511 1971-02-03T09:16:06.78+0511 1971-02-03T09:16:06.7+0511 1971-02-03T09:16:06+0511 1971-02-03T09:16+0511 1970-06-29T21:06:40.981-0400 2013-02-20T13:29:11.100-0500 2013-02-20T13:29:11.100-0501
Only on systems where time_t is large enough:
2058-02-20T13:29:11.100-0500
Local times (meaning we need to get whatever the current time zone is because it is not UTC or explicitly specified) are not currently allowed.
1970-01-01T00:00:00.000 1970-01-01T00:00:00 1970-01-01T00:00 1970-01-01T00 1970-01-01 1970-01 1970
See time_support_test.cpp for the list of test cases specifying this behavior.
Caveats:
Note that 1970-01-01T00:00:00.000Z is the Unix timestamp of 0, since it represents the beginning of the epoch. We cannot currently represent dates before the Unix epoch, so any date before this is invalid.
Note that this restriction has another manifestation. The date "1969-12-31T19:00:00-05:00", while technically representing the Unix timestamp of 0, cannot be parsed by the current implementation since the date is parsed before applying the offset.
- depends on
-
SERVER-11814 JSON parser should support $date fields with values represented as ISO-8601 date strings.
- Closed