PHP connection to the mongodb database

Source: Internet
Author: User
PHP is used to connect to the mongodb database. I use PHP to connect to the mango database, and I can also create a database, that is, I cannot insert data. The operations of the mango database on the SHELL client are normal. The following is the test code.
 "MongoDB", "type" => "database", "count" => 1, "info" => (object) array ("x" => 203, "y" => 102), "versions" => array ("0.9.7", "0.9.8", "0.9.9"); $ connection = new clients client (); $ collection = $ connection-> mydb-> tbname; $ collection-> insert ($ doc);?>

This is found in the database after running. mydb has been created successfully, but the data is empty.

It has been bothering me for a few days. I don't know what went wrong. please help me.
If it is unclear, add QQ 11-50-96-770.


Reply to discussion (solution)

Db. mydb. find () is incorrect.
Db. <Set name> . Find () you have written the library name.
Use show collections to view the set
Then execute this db statement. you can view the set. find ()

Thank you.

I 've been suffering for a few days. it turns out that my database data is not complete. Big God, you add me QQ. I must send you a red envelope.

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.