Skip to content

Instantly share code, notes, and snippets.

@devrim devrim/gist:628727

Created Oct 15, 2010
What would you like to do?
Mongo $exists problem
$q = array("myKey" => array('$exists'=>true));
$cursor = $mongo->db->coll->find($q);
echo $cursor->count(); // this returns the number 51
$v = $cursor->getNext();
print_r($v); // this returns nothing

This comment has been minimized.

Copy link
Owner Author

devrim commented Oct 15, 2010

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.