Database

[{_id:"62a0f3fb362c239460e8ee09",_f:"611531d23039d93be3bf2e2a",_t:"61bdd50570a6a12866e3297f",createdAt:"2022-06-08T19:03:35.246Z"},{_id:"62a0f3fb362c239460e8ee02",_f:"61bdd50570a6a12866e3297f",_t:"611531d23039d93be3bf2e2a",createdAt:"2022-06-08T19:03:35.246Z"},{_id:"62a0f3fb362c239460e8ee08",_f:"61bdd50570a6a12866e3297f",_t:"611531d23039d93be3bf2e22",createdAt:"2022-06-08T19:03:35.246Z"}]

Query

db.collection.aggregate([{$lookup:{from:"collection",let:{f:"$_f",t:"$_t"},pipeline:[{$match:{$expr:{$and:[{$eq:["$_t","$$f"]},{$eq:["$_f","$$t"]}]}}},{$project:{_id:1}}],as:"hasCouple"}},{$match:{$expr:{$gt:[{$size:"$hasCouple"},0]}}},{$set:{hasCouple:{$first:"$hasCouple._id"}}}])

Result