PHP Simple Operation MongoDB Method (installation and additions and deletions to change), MongoDB additions and deletions
This article describes the simple operation of the MongoDB method of PHP. Share to everyone for your reference, as follows:
PHP operation MongoDB Words first from the Internet to download MongoDB expansion pack, https://github.com/mongodb/mongo-php-driver/downloads, select the corresponding expansion pack.
This is my next, then unzip, VC6 fit Apache,vc9 suitable for iis,ts (thread safe) refers to PHP running as a module.
Then put the Php_mongo.dll in PHP in the Ext folder, and then add Extension=php_mongo.dll inside the php.ini, restart Apache.
At this point the PHP extension MongoDB package installation is complete.
About querying MongoDB Some use functions can query the manual http://us.php.net/manual/en/class.mongocollection.php
<?phperror_reporting (7), $conn = new Mongo (); $db = $conn->phpdatabase; $collection = $db phpcollection;/*-----------------------------* Delete *-----------------------------$collection->remove (" Name "=" xixi111 ") *//*------------------------------* Insert *------------------------------for ($i = 0; $i <= 50;$ i++) {$data = array ("name" = "Xixi". $i, "Email" = "673048143_". $i. " @qq. com "," age "= $i *1+20); $collection->insert ($data);} *//*-------------------------------* Find *-------------------------------$res = $collection->find (Array ("Age" = > Array (' $gt ', ' $lt ' = ' + '), Array ("name" = True), foreach ($res as $v) {print_r ($v);} *//*-------------------------------* Update *-------------------------------$collection->update (Array ("Age" = Array (' $set ' = = Array ("name" = "Demoxixi")); */?>
More interested in PHP related content readers can view this site: "PHP+MONGODB database Operation Skills Daquan", "PHP based on PDO Operation Database Skills summary", "PHP Object-oriented Programming tutorial", "PHP String Usage Summary", " Php+mysql database Operation Tutorial "and" PHP common database Operation Skills Summary "
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/PHPjc/1133084.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133084.html techarticle PHP Simple Operation MongoDB Method (installation and additions and deletions to change), MongoDB additions and deletions This article describes the PHP simple operation MongoDB method. Share to everyone for reference, as follows: PHP operation ...