Mongo: Finding from multiple queries

Posted by waxical on Stack Overflow See other posts from Stack Overflow or by waxical
Published on 2012-10-26T16:59:28Z Indexed on 2012/10/26 17:00 UTC
Read the original article Hit count: 133

Filed under:
|
|

New to Mongo here. I'm using the PHP lib and trying to work out how I can find in a collection from multiple queries. I could do this by repeating the query with a different query, but I wondered if it can be done in one.

I.e.

$idsToLookFor = array(2124,4241,5553);
$query = $db->thisCollection->find(array('id' => $idsToLookFor));

That's what I'd like to do. However it doesn't work. What I'm trying to do is find a set of results for all the id's at one time.

Possible or just do a findOne on each with a foreach/for?

© Stack Overflow or respective owner

Related posts about php

Related posts about query