Skip to content
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