@@ -468,22 +468,29 @@ different ``$lookup`` operations.
468
468
469
469
- ``$lookup`` operations that perform equality matches with a
470
470
single join typically perform better when the source collection
471
- contains an index on the ``foreignField ``.
471
+ contains an index on the ``localField ``.
472
472
473
- * - :ref:`Uncorrelated Subqueries<lookup-uncorrelated-subquery>`
473
+ - An index on the ``foreignField`` in the foreign collection
474
+ cannot support an equality match with a single join.
474
475
475
- - .. _uncorrelated-subqueries-performance:
476
+ * - :ref:`Uncorrelated Subqueries <lookup-uncorrelated-subquery>`
476
477
477
- - ``$lookup`` operations that contain uncorrelated subqueries
478
- typically perform better when the inner pipeline can reference
479
- an index on the ``foreignField``.
478
+ - .. _uncorrelated-subqueries-performance:
479
+
480
+ - An index on the foreign collection cannot support uncorrelated
481
+ subqueries.
482
+
483
+ - To improve performance for uncorrelated subqueries, use generic
484
+ indexing strategies and query optimization techniques. For
485
+ example, add appropriate indexes to support aggregation stages
486
+ before ``$lookup``.
480
487
481
488
- MongoDB only needs to run the ``$lookup`` subquery once before
482
489
caching the query because there is no relationship between the
483
- source and foreign collections. The ``$lookup`` subquery is not
484
- based on any value in the source collection. This behavior
485
- improves performance for subsequent executions of this query.
486
-
490
+ source and foreign collections. The subquery is not based on
491
+ any value in the source collection. This behavior improves
492
+ performance for subsequent executions of the ``$lookup``
493
+ operation.
487
494
488
495
* - :ref:`Correlated Subqueries <lookup-concise-correlated-subquery>`
489
496
@@ -622,7 +629,7 @@ The operation corresponds to this pseudo-SQL statement:
622
629
);
623
630
624
631
For more information, see
625
- :ref:`Equality Match Performance Considerations<equality-match-performance>`.
632
+ :ref:`Equality Match Performance Considerations <equality-match-performance>`.
626
633
627
634
.. _unwind-example:
628
635
0 commit comments