I have a small issue with the following MongoDB PHP script
$collection = $this->db->retail_details;
$array = array('$OR'=>array(
"salesperson"=>new MongoId($uid),
"Manager"=>new MongoId($uid)
));
$cursor = $collection->find($array);
I have all the rows saleperson and Manager and I am senging thw correct $UID for the manager it wont match the salesperson but it should still return the data as it matches the Manager MongoID.
The operators in mongodb are case-sensitive. So you should use “$or” rather than “$OR”. But i think that your query is incorrect, too, because “$or” requires an indexed array for it’s criteria:
This should work, in my opinion.