PHP一般mongodbクエリー操作

4390 ワード

<?php

//      

$querys = array("name"=>"shian");

 

//       

$querys = array("number"=>7);

 

//       

$querys = array("number"=>array('$gt' => 5));

 

//         

$querys = array("number"=>array('$gte' => 2));

 

//       

$querys = array("number"=>array('$lt' => 5));

 

//         

$querys = array("number"=>array('$lte' => 2));

 

//       

$querys = array("number"=>array('$gt' => 1,'$lt' => 9));

 

//        

$querys = array("number"=>array('$ne' => 9));

 

//   js     

$js = "function(){

    return this.number == 2 && this.name == 'shian';

}";

$querys = array('$where'=>$js);

 

//        

$querys = array("number"=>array('$in' => array(1,2,9)));

 

//         

$querys = array("number"=>array('$nin' => array(1,2,9)));

 

//       

$querys = array("name" => new MongoRegex("/shi/$i"));

 

//  

$querys = array('$or' => array(array('number'=>2),array('number'=>9)));

?>