Im trying to make this query on Mongo:
{"localization": {"$within" : {"$box" : [ [-3.725502, 40.447323],[-3.659039095404374 , 40.4189327481702]]}}}
I translated to an array and it looks like this:
array("localization" => array('$within' => array('$box' => array('[[-3.725502, 40.447323]', '[-3.659039095404374 , 40.4189327481702]]'))))
And I get no results, if I make the previous Mongo query on the server I get 200 results, but not in PHP. As a result is:
object(MongoCursor)#5 (0) { }
Any ideas what could be wrong? Thanks.
It looks like you are passing $box an array of strings in PHP, not an array of arrays.
Try:
'$box' => array(array(-3.725502, 40.447323), array(-3.659039095404374 , 40.4189327481702'))