Skip to content

Commit 00cdfb6

Browse files
authored
DOCS-14442 $in operator performance limitation (#258)
* DOCS-14442 operator limitation * DOCS-14442 Fixes from internal review * DOCS-14442 Refactor per Nic Feedback * DOCS-14442 Refactor per Nic Feedback * DOCS-14442 Refactor per Nic Feedback * DOCS-14442 Refactor per Nic Feedback
1 parent f6a3882 commit 00cdfb6

File tree

1 file changed

+10
-0
lines changed
  • source/reference/operator/query

1 file changed

+10
-0
lines changed

source/reference/operator/query/in.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ $in
2727
at least one element that matches a value in the specified array
2828
(for example, ``<value1>``, ``<value2>``, and so on).
2929

30+
The :query:`$in` operator compares each parameter to each document
31+
in the collection, which can lead to performance issues.
32+
To improve performance:
33+
34+
* It is recommended that you limit the number of parameters passed to the
35+
:query:`$in` operator to tens of values. Using hundreds of parameters
36+
or more can negatively impact query performance.
37+
38+
* Create an index on the ``field`` you want to query.
39+
3040
.. note::
3141

3242
This document describes the :query:`$in` query operator.

0 commit comments

Comments
 (0)