{ "_id" : 1, "Quality" : [ "HIGH", "LOW", "LOW", "HIGH" ], "Pages" : [ 10, 10, 12, 17 ] }
我需要结果作为
{ "_id" : 1, "HIGH" : 27 "LOW" : 22 }
我想用 $筛选器 $arrayElemAt公司 ,但在筛选页面属性时无法获取索引位置
high : { $sum:{ $filter: { input: "$Pages", as: "noOfPages", cond: {"$eq":[{ $arrayElemAt: ["$Quality", **Need to pass index position of $pages while filtering**]}, "HIGH"]}}}}