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

if count or match after lookup very slow

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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

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

              Dates

              Created:
              Updated:
              Resolved: