Home > Article > Web Front-end > PHP extension to mongodb (first acquaintance)_javascript skills
Under the coercion of the blogger, I would like to share a little with you. I hereby declare that the blogger is very simple and honest. This is just a coercion, and there is absolutely no inducement.
Since there is less Chinese information related to mongodb, I will continue to share it with you if I have the opportunity. I hope this little sharing can bring something to everyone. Let’s get back to the point, please read on.
Why do you say "we met each other for the first time"? Because the data storage format of mongodb is a kind of data storage format. MongoDB's document structure is BJSON format (full name of BJSON: BinaryJSON), and the BJSON format itself supports saving data in binary format. , so the binary format data of the file can be saved directly into the MongoDB document structure.
MongoDB is composed of three levels: database, collection, and document object. Correspondence between
and relational database:
Relational database MongoDB database
Database database
table collection
Row document
can be used in MongoDB When creating an index, there is a default hidden field _id in the collection.
Installation and use
Install mongodb under windows and simply use mongodb command
1. Download and unzip the file
Go to the official website to download the appropriate version http:/ /www.mongodb.org/downloads
For example: http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.2.1.zip
Unzip and place it under the corresponding drive letter, for example : D:mongodb
2. Installation
1. Add the bin directory to the environment variable D:mongodbbin
2. Create a data folder under D:mongodb to store data. You also need to create a db folder under the data file. Without the db folder, mongodb cannot start normally
3. Simple method to start mongodb:
Enter the bin directory
3. Next, the same operation as for all databases requires adding a user’s defense permission
But the user created at this time does not have the permission to view the collection. What to do! In fact, it's easy to handle. I've already had a headache for everyone, so students who can persist in seeing this with their heart won't have any more headaches.
Execute the following command in the mongo.exe management interface you just entered
You can see it after entering
2. A more recommended management software is "rockmongo"
It needs the support of PHP operating environment. I prefer it because PHP programmers have a ready-made environment and don't need to use it in vain, haha .
(1). Download a rockmongo, unzip it and put it in the web directory. Download address: http://rockmongo.com/downloads
If you don’t have a PHP operating environment but want to use rockmongo, you can Integrate package download in the download address.
(2). Download a php_mongo.dll that supports mongodb. Download address: https://github.com/mongodb/mongo-php-driver/downloads
(3). Add it to php.ini This line of code extension=php_mongo.dll Then restart apache and check php_info
means the installation has been successful
(4). Enter the address of rockmongo in the browser, a login box will appear, and you can log in. The default user is: admin Password: admin
There are many other tools, you can explore slowly.