Skip to content

(DOCS-14763): Clarify sample agg behavior warning #5983

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

Merged
merged 1 commit into from
Oct 13, 2021
Merged
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
14 changes: 11 additions & 3 deletions source/reference/operator/aggregation/sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ collection scan followed by a random sort to select N documents. In
this case, the :pipeline:`$sample` stage is subject to the
:ref:`sort memory restrictions <sort-memory-limit>`.

.. warning::
MMAPV1 May Return Duplicate Documents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:pipeline:`$sample` may output the same document more than once in
its result set. For more information, see :ref:`cursor-isolation`.
If you are using the:

- MMAPV1 storage engine, :pipeline:`$sample` may return the same
document more than once in the result set.

- :ref:`WiredTiger <storage-wiredtiger>` or
:ref:`in-memory <storage-inmemory>` storage engine,
:pipeline:`$sample` does not return duplicate documents. WiredTiger
is the default storage engine as of MongoDB 3.2.

Example
--------
Expand Down