-
Hi ! I am trying to run an aggregation pipeline on one of my collection that has multiple stages. The purpose of it is to get an array of data, and then, depending on a condition, running (or not) another aggregation pipeline with this transformed data. We already have an aggregation pipeline who does that by having a The issue is that To resolve that, I tried to run 2 aggregation pipelines sequentially, but I don't want to use a "temporary collection" to store the results of the first pipeline to put as input in the 2nd one (with Is there soemone who managed to achieve something similar ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
What makes you think the Another potential alternative would be to use |
Beta Was this translation helpful? Give feedback.
-
@vkarpov15 Here is a simple reproduction repository. Just need to |
Beta Was this translation helpful? Give feedback.
@yannispgs run
mongoose.connection.aggregate()
notTestModel.aggregate
. MongoDB only supports$documents
in db-level aggregate, not collection level aggregate.