开发者

PHP MongoDB $and / $all querying

If I want to select documents that meet two specific criteria, how do I format the query? Right now I开发者_开发技巧 currently have this:

$params = array('$all' => array(
              array('parent.id'=>'1'),
              array('owner_id'=>'8')
          ));
$data = $collection->find($params);

This query brings me back no results...any ideas??


parent.id is integer?

Maybe that:

$params = array('$all' => array(
              array('parent.id'=>1),
              array('owner_id'=>8)
          ));
$data = $collection->find($params);


Ouh.. Use it:

$params = array('$all' => array(
              array('parent'=>array('id'=>'1')),
              array('owner_id'=>8)
          ));
$data = $collection->find($params);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜