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

Lookup sub-pipeline is not using index for equality match

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.3, 3.7.1
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • Environment:
      MongoDB server version: 3.6.0-rc1
    • Fully Compatible
    • ALL
    • v3.6
    • Query 2017-11-13, Query 2017-12-04, Query 2017-12-18, Query 2018-01-01, Query 2018-01-15
    • 0

      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'
        }}
      ])
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            naveenk Naveen
            Votes:
            4 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:
              Resolved: