I want to have query like this :
This query will select one document in the friendrequest collection where either the sender_id equals "id1" AND receiver_id equals "id2" OR sender_id equals = "id2" AND receiver_id equals "id1"
So can anyone help me to build that query ?
select * from friendrequest where (sender_id = "id1" and receiver_id = "id2") OR (receiver_id = "id1" and sender_id = "id2") for mySql
Error:
friendRequests.findOne({$or:[{$and:[{sender_id:req.body._id,receiver_id:req.body._uid2}],$and:[{sender_id:req.body._uid2,receiver_id:req.body._id}]}