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