@@ -537,22 +537,29 @@ different ``$lookup`` operations.
537
537
538
538
- ``$lookup`` operations that perform equality matches with a
539
539
single join typically perform better when the source collection
540
- contains an index on the ``foreignField ``.
540
+ contains an index on the ``localField ``.
541
541
542
- * - :ref:`Uncorrelated Subqueries<lookup-uncorrelated-subquery>`
542
+ - An index on the ``foreignField`` in the foreign collection
543
+ cannot support an equality match with a single join.
543
544
544
- - .. _uncorrelated-subqueries-performance:
545
+ * - :ref:`Uncorrelated Subqueries <lookup-uncorrelated-subquery>`
545
546
546
- - ``$lookup`` operations that contain uncorrelated subqueries
547
- typically perform better when the inner pipeline can reference
548
- an index on the ``foreignField``.
547
+ - .. _uncorrelated-subqueries-performance:
548
+
549
+ - An index on the foreign collection cannot support uncorrelated
550
+ subqueries.
551
+
552
+ - To improve performance for uncorrelated subqueries, use generic
553
+ indexing strategies and query optimization techniques. For
554
+ example, add appropriate indexes to support aggregation stages
555
+ before ``$lookup``.
549
556
550
557
- MongoDB only needs to run the ``$lookup`` subquery once before
551
558
caching the query because there is no relationship between the
552
- source and foreign collections. The ``$lookup`` subquery is not
553
- based on any value in the source collection. This behavior
554
- improves performance for subsequent executions of this query.
555
-
559
+ source and foreign collections. The subquery is not based on
560
+ any value in the source collection. This behavior improves
561
+ performance for subsequent executions of the ``$lookup``
562
+ operation.
556
563
557
564
* - :ref:`Correlated Subqueries <lookup-concise-correlated-subquery>`
558
565
@@ -691,7 +698,7 @@ The operation corresponds to this pseudo-SQL statement:
691
698
);
692
699
693
700
For more information, see
694
- :ref:`Equality Match Performance Considerations<equality-match-performance>`.
701
+ :ref:`Equality Match Performance Considerations <equality-match-performance>`.
695
702
696
703
.. _unwind-example:
697
704
0 commit comments