1

I can do a bounding box location query fine, like this:

$cursor = $coll->find(array('loc' => array('$within' => array('$box' => $box))));

And another basic query works:

$cursor = $coll->find(array('type' => $filter));

But when I try to combine both into a new query, it's not working:

$cursor = $coll->find(array(

    array('loc' => array('$within' => array('$box' => $box))), 

    array('type' => $filter)

)); 

Am I handling the query string incorrectly?

1 Answer 1

1

Your syntax is not correct, you should simply do:

$cursor = $coll->find(array(
    'loc' => array('$within' => array('$box' => $box)),
    'type' => $filter,
)); 

Ie, have one array with all the query parts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.