I want to convert a string to php code.
$criteria = "\"department\" => array('\$in' => array(\"IT\"))";
My actual Mongodb query is this,
$collection->find(array("name" => $a, "department" => array('$in' => array("IT")));
But what I need is, query should be based on criteria..
$collection->find(array("name" => $a, $criteria);
But this doesn't seem to work for me.
I even tried eval($criteria)
and then tried it. Negative result.
Where am I going wrong? Any help would be appreciated.