Skip to content

DOCS-3879: Document changes for 2.6 in date formatting #1979

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion source/reference/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ Glossary
:term:`primary` on startup and in the event of a failure. See
:ref:`replica-set-elections`.

unix epoch
January 1st, 1970 at 00:00:00 UTC. Commonly used in expressing time,
where the number of seconds or milliseconds since this point is counted.

eventual consistency
A property of a distributed system that allows changes to the
system to propagate gradually. In a database system, this means
Expand Down Expand Up @@ -544,7 +548,7 @@ Glossary
moving a document when it grows as the result of
:method:`~db.collection.update()`
operations. See :ref:`record-allocation-strategies`.

padding factor
An automatically-calibrated constant used to determine how much
extra space MongoDB should allocate per document container on disk.
Expand Down
15 changes: 11 additions & 4 deletions source/reference/mongodb-extended-json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,23 @@ Date

* - .. code-block:: none

{ "$date": <date> }
{ "$date": "<date>" }

-

- .. code-block:: none

new Date ( <date> )

``<date>`` is the JSON representation of a 64-bit signed integer for
milliseconds since epoch UTC (unsigned before version 1.9.1).
In *Strict mode*, ``<date>`` is typically an ISO-8601 date format following
the template ``YYYY-MM-DDTHH:mm:ss.mmm<+/-Offset>``. When formatting
pre-:term:`unix epoch` dates, the format instead encodes as a string the
negative integer giving the number of milliseconds since epoch UTC:

``{ "$date" : { "$numberLong" : "<date>" } }``

In *Shell mode*, ``<date>`` is the JSON representation of a 64-bit signed
integer giving the number of milliseconds since epoch UTC.

Timestamp
~~~~~~~~~
Expand Down Expand Up @@ -368,5 +375,5 @@ NumberLong
- .. code-block:: none

NumberLong( <number> )

Number long is a 64 bit signed integer.
20 changes: 16 additions & 4 deletions source/release-notes/2.6-compatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,8 @@ Timestamp Format Change
~~~~~~~~~~~~~~~~~~~~~~~

Description
Each message now starts with the timestamp formatted in
``iso8601-local``, i.e. ``YYYY-MM-DDTHH:mm:ss.mmm<+/-Offset>``. For
example, ``2014-03-04T20:13:38.944-0500``. Previous versions used
``ctime`` format.
Each message now starts with the timestamp format given in :ref:`2.6-time-format-changes`.
Previous versions used the ``ctime`` format.

Solution
MongoDB adds a new option :option:`--timeStampFormat` which supports
Expand Down Expand Up @@ -902,6 +900,20 @@ Solution
Update :data:`local.system.replset.members[n].votes` with values
other than 1 or 0 to 1 or 0 as appropriate.

.. _2.6-time-format-changes:

Time Format Changes
-------------------

MongoDB now uses ``iso8601-local`` when formatting time for many output purposes.
This format follows the template ``YYYY-MM-DDTHH:mm:ss.mmm<+/-Offset>``. For
example, ``2014-03-04T20:13:38.944-0500``.

This change impacts anything using
:doc:`Extended JSON </reference/mongodb-extended-json>` in *Strict mode*, such as
:program:`mongoexport` and the :ecosystem:`REST and HTTP Interfaces
</tools/http-interfaces>`.

.. _2.6-compatibility-other-resources:

Other Resources
Expand Down