I am using the following aggregation pipeline which is matching to what is mentioned in the answer:
var pipeline1 = [
{ $match: { airplane: /747|380/ } },
{ $lookup: { from: “air_alliances”, localField: “airlines”, foreignField: “airline.name”, as: “alliance”} },
{ $unwind: “$alliance” },
{ $group: { _id: “$alliance.name”, count: { “$sum”: 1 } } },
{ $sort: { count: -1 } }
]
But executing this pipeline is giving me wrong result.
Can someone let me know what’s wrong with this pipeline?