Skip to content

DOCS-1356 Warning information for sorting by ObjectId #830

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 3 commits into from
Closed
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
16 changes: 13 additions & 3 deletions source/reference/object-id.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ additional benefits:
<ObjectId.getTimestamp()>` method.

- sorting on an ``_id`` field that stores ``ObjectId`` values is
roughly equivalent to sorting by creation time, although this
relationship is not strict with ``ObjectId`` values generated on
multiple systems within a single second.
roughly equivalent to sorting by creation time.

.. important::

This relationship is not strict with ``ObjectId`` values
generated within a single second. This can happen if the
values are generated by multiple systems (or by multiple
processes or threads on a single system) within a second,
or as a result of clock skew on the client side, which
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can even be in a single system with multiple processes or threads (depending on the client language implementation).

would result in non-strict behavior even for entries that
are multiple seconds apart. This is because the ObjectId
is generated by the client driver rather than the mongod
process upon insert.

Also consider the :doc:`/core/document/` section for related
information on MongoDB's document orientation.
Expand Down