呼如林
您可以使用$ match和$ project管道进行多个字段匹配。(请参阅此处的详细答案-mongoDB在多个字段上联接)db.collection1.aggregate([ {"$lookup": { "from": "collection2", "localField": "user1", "foreignField": "user1", "as": "c2" }}, {"$unwind": "$c2"}, {"$project": { "user2Eq": {"$eq": ["$user2", "$c2.user2"]}, "user1": 1, "user2": 1, "percent1": "$percent", "percent2": "$c2.percent" }}, {"$match": { {"user2Eq": {"$eq": True}} }}, {"$project": { "user2Eq": 0 }} ])