[DOCS-2539] Document ISODate support in JSON parser Created: 15/Jan/14  Updated: 04/Mar/23  Resolved: 18/Sep/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.11, mongodb-2.6

Type: Task Priority: Major - P3
Reporter: Shaun Verch Assignee: Andrew Aldridge
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-11814 JSON parser should support $date fiel... Closed
Related
is related to DOCS-3879 Change in mongoexport output format f... Closed
is related to DOCS-6992 Date format for Shell Extended JSON i... Closed
Participants:
Days since reply: 9 years, 21 weeks, 6 days ago

 Description   

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.



 Comments   
Comment by Githook User [ 18/Sep/14 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-2539: Document ISODate JSON parsing restrictions.

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/6d477af4b4b183271c10cca1774bcde0f23c3125

Generated at Thu Feb 08 07:43:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.