Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13263

Add note to "Multiple Join Conditions with $lookup" on index usage

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: manual
    • Labels:
      None
    • Last comment by Customer:
      true
    • Sprint:
      ServerDocs2020: Aug24 - Aug31, ServerDocs2020: Aug31 - Sep07, ServerDocs2020: Sep8 - Sep14

      Description

      Description

      When using aggregation with $lookup using a pipeline stage:

      https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/#specify-multiple-join-conditions-with-lookup

       

      We should add a note that $expr will only use indexes on the "from" collection for EQUALITY matches ONLY.  In the example, it will only use an index on "warehouses.stock_item".  It's unable to use it for the range component (warehouses.instock).

       

      Details here: https://jira.mongodb.org/browse/HELP-11242?focusedCommentId=2407968&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2407968

       

      I bring this to your attention since it can have profound performance implications when using $lookup.

       

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

        Attachments

          Activity

            People

            Assignee:
            jason.price Jason Price
            Reporter:
            shakir.sadikali Shakir Sadikali
            Participants:
            Last commenter:
            Andrew Feierabend Andrew Feierabend (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Days since reply:
              1 year, 1 week, 6 days ago
              Date of 1st Reply: