Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31760

Lookup sub-pipeline is not using index for equality match

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.3, 3.7.1
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Environment:
      MongoDB server version: 3.6.0-rc1
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.6
    • Sprint:
      Query 2017-11-13, Query 2017-12-04, Query 2017-12-18, Query 2018-01-01, Query 2018-01-15
    • Linked BF Score:
      0

      Description

      I am doing following aggregation to join two collection using foreign pipeline.
      It seems match stage is not using index at all.

      db.blogpost.aggregate([
        { $lookup: { 
          from: 'comment', 
          let: { blogpost_id: "$_id" }, 
          pipeline: [ { 
             $match: { $expr: { $eq: [ "$blogpost.id", "$$blogpost_id"] } } 
          } ], 
          as: 'comments'
        }}
      ])
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                18 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: