[SERVER-48666] if count or match after lookup very slow Created: 09/Jun/20  Updated: 09/Jun/20  Resolved: 09/Jun/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: George Wang Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 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



 Comments   
Comment by Carl Champain (Inactive) [ 09/Jun/20 ]

Hi huzech@gmail.com,

The SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will now close it. If you need assistance troubleshooting, I encourage you to ask our community by posting on the MongoDB Community Forums or on Stack Overflow with the mongodb tag.

Kind regards,
Carl

Generated at Thu Feb 08 05:17:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.