Possibility to set variables used in pipeline stages
Hi !
It would be really handfull to have the possibility to use variables in the pipeline stages:
var userId = ObjectId("5f61dfadc1e8960001700da8'")
{
$match : {user.id : userId}
}
for complex queries, it would avoid having to modify the id at each stages.
Thanks !
9
votes
![](https://secure.gravatar.com/avatar/2f3028821167cfc73c02b24a8d0af0f6?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
Albert commented
I 100% agree.
Using variables for the same date matching in different stages would be another usefulll example.