Database

[{"key":1,value:2},{"key":2,value:4},{"key":5,value:5}]

Query

db.collection.aggregate([{$match:{$expr:{$eq:["$key","$value"]}}}])

Result