Created
October 15, 2010 18:50
-
-
Save devrim/628727 to your computer and use it in GitHub Desktop.
Mongo $exists problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$q = array("myKey" => array('$exists'=>true)); | |
$cursor = $mongo->db->coll->find($q); | |
echo $cursor->count(); // this returns the number 51 | |
while($cursor->hasNext()){ | |
$v = $cursor->getNext(); | |
print_r($v); // this returns nothing | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solved it - if you do
$q = array("myKey.Subkey" => array('$exists'=>true));
then it works. i guess it's a weird bug on php driver.