So, I’d like to store permanent collection queries in another collection to later populate these with $lookup. Unfortunately, when I try to $match $$ROOT it fails no matter how I try to work this around.
Here’s what I expected to work, in a nutshell: Mongo playground
I ended up with $function to match the documents JS-way but I’m still interested if there’s a way to make the use of $match while storing the query in an object. Maybe there’s an option to “unpack” the variable into an object?