Under the threat of the bloggers, I would like to share with you a little bit. I hereby declare that the product of the bloggers is very simple, just a threat, and there is no temptation.
Due to the small amount of Chinese data related to mongodb, we will continue to share it with you later. I hope this small sharing will bring you some benefits. Let's take a closer look.
Why does it mean that the data storage format of apsaradb for mongodb is BJSON because the document structure of apsaradb for MongoDB is BJSON (full name of BJSON: BinaryJSON ), BJSON supports binary data storage. Therefore, you can directly store binary data in the document structure of MongoDB.
MongoDB consists of three layers: database, collection, and document.
Relationship with relational databases:
Apsaradb for MongoDB
Database database
Table collection
Row document
You can create an index in MongoDB. The collection contains a default hidden field _ id.
Installation and Use
Install mongodb in windows and use mongodb commands
1. Download and decompress the file
Download the right version of http://www.mongodb.org/downloads to official
Example: http://fastdl.mongodb.org/win32/mongodb-win32-i386-2.2.1.zip
Decompress the package and put it under the corresponding drive letter, for example, D: \ mongodb
Ii. Installation
1. Add the bin directory to the environment variable D: \ mongodb \ bin
2. Create a data folder under D: \ mongodb for data storage and create a db folder under the data file. mongodb cannot be started normally without a db folder.
3. Simple mongodb startup method:
Go to the bin directoryCopy codeThe Code is as follows: C: \ Documents ents and Settings \ me> D:
D: \> cd mongodb/bin
D: \ mongodb \ bin> mongod-dbpath D:/mongodb/data
D: \ mongodb \ bin> mongod-dbpath D:/mongodb/data
The following content is displayed:
Sun Jan 16 14:56:03 MongoDB starting: pid = 860 port = 27017 dbpath = D:/mongodb/d
Ata 32-bit
** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** See http://blog.mongodb.org/post/137788967/32-bit-limitations
Sun Jan 16 14:56:03 db version v2.2.1, pdfile version 4.5
Sun Jan 16 14:56:03 git version: 0eb017e9b2828155a67c5612183337b89e12e291
Sun Jan 16 14:56:03 sys info: windows (5, 1, 2600, 2, 'service Pack 3') BOOST_LI
B _VERSION = Limit 35
Sun Jan 16 14:56:03 [initandlisten] waiting for connectionon port 27017
Sun Jan 16 14:56:03 [websvr] web admin interface listening on port 28017
Note:You must first create a data folder and run it in the bin directory. The default connection port of the mongoDB server is 27017.
2. Add the service to the Registry and start it as a Windows service. The service is automatically started when Windows is started like mysql, and executed in the bin directory.Copy codeThe Code is as follows: D: \ mongodb \ bin> mongod -- logpath D: \ mongodb \ log \ log1.log -- logappend
-- Dbpath D: \ mongodb \ data -- directoryperdb -- serviceName mongodb-install
Output the following content after completion (anti-virus software such as 360 will block and must pass)
All output going to: D: \ mongodb \ logs \ log1.log
Creating service mongodb
Service creation successful.
Service can be started from the command line via 'net start "mongodb ″'.
D: \ mongodb \ bin>
Here, log \ log1.log is output in append mode, and-serviceName mongodb is the service name.
Start MongoDB: net start mongodb
Stop MongoDB: net stop mongodb
Note: After you add the service to the Registry, restart the computer and check that the service has been started. However, if the service is not started, restart the service and find that the service has blocked 360 security guard, you must confirm again before starting the service.
3.mongodbsimple command, execute cmd.exe under the bincommand to enter the management interface, the default is to enter the test account.Copy codeThe Code is as follows: D: \ mongodb \ bin> cmd.exe
MongoDB shell version: 2.2.1
Connecting to: test
> Show dbs;
Admin
Local
> Help; view command prompts
3. Next, add a user's anti-question permission for the same operations as all databases.
However, the created user does not have the permission to view the set. What should I do! As a matter of fact, I have already had a headache for everyone, so I am able to insist on seeing the students here will not have a headache any more.
Execute the following command on the just-accessed cmd.exe Management Interface
Copy codeThe Code is as follows:> use admin
> Db. auth ("sa", "sa ")
> Use web
> Show collections
It will be unobstructed this time.
4. MongoDB can be used to create a database as follows: use web; in this way, a database is created.
Switch to the web database. If no data exists, a new web folder is automatically created after the data is inserted.Copy codeThe Code is as follows:> use web;
Switched to db web
> Db. my. save ({a: 10}); save a message to collection my. If no collection exists,
> Db. my. find (); Retrieve all records
{"_ Id": ObjectId ("4d32c9204e6425691e"), "a": 10}
> Show collections;
My
System. indexes
> Exit; exit
The Mongodb installation and user permission settings have ended.
The following describes several graphical management tools.
1. Use the graphical language management tool "invalid vue 0.9.7.2"
You can see
2. One of the recommended management software is rockmongo"
I prefer the php runtime environment because php programmers do not need to use the ready-made environment.
(1) download a rockmongo, unzip and put it in the web directory: http://rockmongo.com/downloads
If you do not have a php runtime environment, but want to use rockmongo, you can download it from the integration package.
(2) download a php mongodb support php_mongo.dll: https://github.com/mongodb/mongo-php-driver/downloads
(3) add this line of code extension = php_mongo.dll to php. ini, restart apache, and view php_info.
Indicates that the installation is successful.
(4) enter the rockmongo address in the browser and the logon box appears. The default user is admin password: admin.
There are many other tools you can explore.