带有php的Mongodb不能使用where查询

带有php的Mongodb不能使用where查询,php,mongodb,Php,Mongodb,我已经安装了带有php mongo驱动程序v.1.6.3的Mongodb v.2.6.7 当我得到所有数据时,它都正常工作,但如果我使用where查询,它会将空数组返回给我 <?php $m = new MongoClient(); $db = $m->selectDB('test'); $collection = new MongoCollection($db, 'phpmanual'); // search for documents where 5 < x <

我已经安装了带有php mongo驱动程序v.1.6.3的Mongodb v.2.6.7 当我得到所有数据时,它都正常工作,但如果我使用where查询,它会将空数组返回给我

<?php

$m = new MongoClient();
$db = $m->selectDB('test');
$collection = new MongoCollection($db, 'phpmanual');

// search for documents where 5 < x < 20
$rangeQuery = array('x' => array( '$gt' => 5, '$lt' => 20 ));

$cursor = $collection->find($rangeQuery);
foreach ($cursor as $doc) {
    var_dump($doc);
}

谢谢Neil Lunn,现在我的问题已经解决了,但是现在它在limit1中有其他错误,返回结果数组为空,但是当我使用limit2时,返回结果对我来说是正确的,我不知道为什么?下面是我要使用的代码:$resutl=$this->mongo_db->limit1->get'UserProfile';