You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the library allows to pass in an aggregation query that shapes the paginated results. One thing that I cannot seem to understand, is that since we are retrieving multiple unknown aggregated objects, the $match stage appears to be off the table. This makes more complex aggregation queries (such as the ones using $lookup stage very slow). For example:
Let's say I have products and containers collections. Products point to containers like so:
Hello,
So the library allows to pass in an aggregation query that shapes the paginated results. One thing that I cannot seem to understand, is that since we are retrieving multiple unknown aggregated objects, the
$match
stage appears to be off the table. This makes more complex aggregation queries (such as the ones using$lookup
stage very slow). For example:Let's say I have
products
andcontainers
collections. Products point to containers like so:Product collection
Now, if I wanted to retrieve a specific container and $lookup its products, the query would be very fast because I could put
$match
in the beginning:[MATCH container by container ID] [LOOKUP products that share the container id] [PROJECT]
However, with mongoose-aggregate-paginate-v2, I am now retrieving multiple resources, so the MATCH stage is lost, making the LOOKUP very slow?
Is there a way to counter this? What should I do?
The text was updated successfully, but these errors were encountered: