From 42591befe92cf15b280671c70842b370c2d5d18c 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 0abe7f5d149..a6f3a37d41e 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. +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 --------