PHP????MongoDB ??????????
???????????? ???????[ 2014/5/28 11:39:23 ] ????????PHP MongoDB ?????
????5.??????????
//** ?????? **/
$where=array(‘column_name’=>’col685′);
$result=$collection->update($where??array(‘$unset’=>’column_exp’));
/**
* ??????column_exp
*/
/*
* *
* ???????:update(array $criteria?? array $newobj [?? array $options = array() ] )
* ???:1.????????滻????????????
* 2.????????????????? array(’91u’=>’684435′)??array(’91u’=>684435)
* *
*/
//** ???? **/
$collection->remove(); #??????
//** ??????MongoId **/
$id = new MongoId(“4d638ea1d549a02801000011″);
$collection->remove(array(‘_id’=>(object)$id));
|
????6.?????????
//** ???????? **/
echo ‘count:’.$collection->count().”<br>”; #???
echo ‘count:’.$collection->count(array(‘type’=>’user’)).”<br>”; #???‘type’ ? user ????
echo ‘count:’.$collection->count(array(‘age’=>array(‘$gt’=>50??’$lte’=>74))).”<br>”; #??????50С?????74
echo ‘count:’.$collection->find()->limit(5)->skip(0)->count(true).”<br>”; #??????????????
/**
* ?:$gt??????$gte?????????$lt?С???$lte?С??????$ne????????$exists??????
*/
//** ??????????м?? **/
$cursor = $collection->find()->snapshot();
foreach ($cursor as $id => $value) {
echo “$id: “; var_dump($value); echo “<br>”;
}
/**
* ???:
* ??????????find()?????????$cursor?α????????α???????.
* ???仰???????find()?????????α???????????????????з?????????????????collection???????Щ??????$cursor ???.
* ???????????$cursor???????????仯?????????????
* $cursor = $collection->find();
*/
//** ?????????? **/
$cursor = $collection->findOne();
/**
* ???:findOne()??y???????????snapshot()??fields()?????;
*/
//** ?????????? age??type ?в???? **/
$cursor = $collection->find()->fields(array(“age”=>false??”type”=>false));
$cursor = $collection->find()->fields(array(“user”=>true)); //????user ??
/**
* ??????д?????:$cursor->fields(array(“age”=>true??”type”=>false));
*/
//** ???????? (????type??age???) and age!=0 and age<50 **/
$where=array(‘type’=>array(‘$exists’=>true)??’age’=>array(‘$ne’=>0??’$lt’=>50??’$exists’=>true));
$cursor = $collection->find($where);
//** ??????????? **/
$cursor = $collection->find()->limit(5)->skip(0);
//** ???? **/
$cursor = $collection->find()->sort(array(‘age’=>-1??’type’=>1)); ##1??????? -1??????????????????????????
//** ???? **/
$collection->ensureIndex(array(‘age’ => 1??’type’=>-1)); #1??????? -1???????
$collection->ensureIndex(array(‘age’ => 1??’type’=>-1)??array(‘background’=>true)); #???????????????????(????????????)
$collection->ensureIndex(array(‘age’ => 1??’type’=>-1)??array(‘unique’=>true)); #?????????
/**
* ensureIndex (array()??array(‘name’=>’????????’??'background’=true??’unique’=true))
* ???:http://www.php.net/manual/en/mongocollection.ensureindex.php
*/
//** ??ò????? **/
$cursor = $collection->find();
$array=array();
foreach ($cursor as $id => $value) {
$array[]=$value;
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
?????????????????????????Щ????????????????????TC???????????????Щ???????????????????????????????????????????????(java .net ?????)???mysql???????????????????ж????д???Python???????????????(DB2)??????BufferPool????????????????????????????????6??????????????????滮???????????????-????????SQL Server???????????????????λ?????PHP??SQL????????????????????Pythonд???NoSQL????????? SQL ?е????????????? SQL ?е?????????Java???????:?????MySQL???????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????