Skip to content

Commit 53d9c7f

Browse files
Backport DOCSP-27076 to v4.4 (#2845)
* (DOCSP-27076): Clarify version behavior for comparison operators in a $lookup (#2821) * (DOCSP-27076): Remove eq from list of operators that can use a lookup index in 5.0 * remove version reference * add limitation for range query operators
1 parent 8a55735 commit 53d9c7f

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:expression:`$eq` operators placed in an :query:`$expr` operator can use
2+
an index on the ``from`` collection referenced in a :pipeline:`$lookup`
3+
stage. Limitations:
4+
5+
- Range comparison operators (:expression:`$lt`, :expression:`$lte`,
6+
:expression:`$gt`, :expression:`$gte`) cannot use the index.
7+
8+
- :ref:`Multikey indexes <index-type-multikey>` are not used.
9+
10+
- Indexes are not used for comparisons where the operand is an array or
11+
the operand type is undefined.
12+
13+
- Indexes are not used for comparisons with more than one :ref:`field
14+
path <agg-quick-ref-field-paths>` operand.

source/reference/operator/query/expr.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ Definition
3333
Behavior
3434
--------
3535

36-
- :query:`$expr` can build query expressions that compare fields
37-
from the same document in a :pipeline:`$match` stage.
36+
:query:`$expr` can build query expressions that compare fields from the
37+
same document in a :pipeline:`$match` stage.
3838

39-
- If the :pipeline:`$match` stage is part of a :pipeline:`$lookup`
40-
stage, :query:`$expr` can compare fields using ``let`` variables.
41-
See :ref:`lookup-multiple-joins` for an example.
39+
If the :pipeline:`$match` stage is part of a :pipeline:`$lookup` stage,
40+
:query:`$expr` can compare fields using ``let`` variables. See
41+
:ref:`lookup-multiple-joins` for an example.
4242

43-
- :query:`$expr` only uses indexes on the ``from`` collection for
44-
equality matches in a :pipeline:`$match` stage.
45-
46-
- :query:`$expr` does not support
47-
:ref:`multikey indexes <index-type-multikey>`.
43+
.. include:: /includes/expr-operators-and-indexes.rst
4844

4945
Examples
5046
--------

0 commit comments

Comments
 (0)