I am trying to convert the following example from mysql to Mongodb.
However, i am stuck at a point. Any inputs would be highly appreciated.
SQL Query:
$cmd = "SELECT COUNT(*) FROM (SELECT * FROM pkt_tbl WHERE m_out_port= " . $out_port . " AND m_time<=" . $selPointX . " AND m_time>=" . $startTime . ") AS pkt_tbl WHERE m_in_port=" . $i;
Mongodb Query (WHAT I TRIED):
$find_query = array('m_out_port'=>$out_port, 'm_in_port'=>$i,'m_time'=>array('lte' => $selPointX, 'gte'=>$startTime));
$find_projections = count();
$result = $table->find($find_query, $find_projections);
What I tried (Aside from Code)
I read the mongodb docs and other PHP.NET (Mongodocs) but still couldn't find relevant solution.
I am not sure if it's right/I am going in right path.
Please elucidate. - R