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

if count or match after lookup very slow

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      aggregate query like below very slow [{
      "$lookup": {
      "from": "a" ,
      "let":

      { "item": "b" }

      ,
      "pipeline": [
      {
      "$match": {
      "$expr": {
      "$and":[

      {"$eq": [ "$_id", "$$item" ]}

      ]
      }
      }
      },

      { "$limit":1 }

      ],
      "as": "tmp_item"
      }
      },

      { "$count":"count"}

      ]
      I must put $count or $match after $lookup because of use lookup's results

      Attachments

        Activity

          People

            Unassigned Unassigned
            huzech@gmail.com George Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: