I'm pretty new in Mongodb. Just read documentation and played. I wanted to find documents with the word "MIA" and timestamp value between 25th Aug, 2014 to 28th Aug, 2014. I wrote this way
$var = "MIA";
date_default_timezone_set('UTC');
$from = strtotime('2014-08-25');
$to = strtotime('2014-08-28');;
$var = new MongoRegex("/$var/");
$where1 = array( '$or' => array( array(array('caller' => $var)), array('callee' => $var)));
$where2 = array( '$and' => array( array('timestamp' => array('$gte' => $from )), array('timestamp' => array('$lte'=> $to)) ) );
$where = array( '$and' => $where1, $where2 );
//var_dump($where);
$cursor = $collection->find($where);
var_dump($cursor);
I was getting empty result. Can you please advice to fix this?
Thanks
EDIT:
Collection Structure
