Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-6992

Date format for Shell Extended JSON is incorrect

      In the Extended JSON reference for the Date type, the Shell style format is

      new Date ( <date> )
      

      where <date> is a 64 bit signed integer of millis since epoch.

      However, while this format is accepted by the shell, it is not what the shell actually outputs:

      > tojson(new Date(NumberLong("1453087907438")))
      ISODate("2016-01-18T03:31:47.438Z")
      

      This format is much easier for humans to work with (while still being reasonable for machines to deal with).

      This has been the case since MongoDB 1.8, and so has become the defacto standard.

      Thus, although ISODate is not a type (DOCS-2927), it is a valid Shell-mode Extended JSON representation of Date objects. Therefore the docs should be updated to list both of these forms as acceptable representations.

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 27 weeks ago