PHP Simple Operation MongoDB Method (installation and additions and deletions to change), MongoDB additions and deletions _php tutorial

Source: Internet
Author: User

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.