From 96d2758c5f453ba27b4e6d0d11603acbafb82595 Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Wed, 1 Sep 2021 12:03:02 -0400 Subject: [PATCH] (DOCS-14763): Clarify sample agg behavior warning --- source/reference/operator/aggregation/sample.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/reference/operator/aggregation/sample.txt b/source/reference/operator/aggregation/sample.txt index c6d1e9ac7bd..3b2eda77e6d 100644 --- a/source/reference/operator/aggregation/sample.txt +++ b/source/reference/operator/aggregation/sample.txt @@ -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 `. -.. 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 ` or + :ref:`in-memory ` storage engine, + :pipeline:`$sample` does not return duplicate documents. WiredTiger + is the default storage engine as of MongoDB 3.2. Example --------