MongoDb Aggregation: How can I group an array-1 based on another array-2 when given array-1 and array-2?
问题 EDIT: My original question was MongoDb Aggregation: Can you $unwind an input document variable in the pipline of a $lookup stage? Consider the code below: {$lookup: { from:"mydoc", let: {"c":"$myArray"}, pipeline: [ {$unwind: "$$c"}, ] as:"myNewDoc" }} How would I unwind c if I wanted to? /////END OF ORIGINAL QUESTION -----EDIT----- From Tom Slabbaert's comment we now know that it is possible to $unwind an input document variable in the pipline of a $lookup stage. But it is not recommended.