These days to learn a bit mongodb, now take a note.
1. First Installation
(preferably installed in the root directory, and then manually build a DB folder)
Installation is complete because MongoDB is required to start manually, locate the Bin folder in the installation directory, hold down SHIFT, right-click, open the command line here, and enter Mongod--dbpath=f:\mongodb\db
The following is the path of your own folder.
After the completion of the Web page input http://localhost:27017 will appear as the following screen is successful connection.
This cmd is to be kept open, and if it is turned off, you have to re-enter the command to start.
2, open a new cmd, input MONGO, you can enter the command, the data operation. In fact, MongoDB and other databases are similar, the name is not the same, some statements are not the same, is not relational. (Just own understanding)
2.1, use test if the database does not have this test, that is, create and point to this database, if so, point to this database, if you want to show test, you must add the database to the test database
2.2, show DBS display collection,
2.3. Inserts the document Insert () Save ()
The above two methods can only be inserted, if you want to bulk INSERT, you can write the function in the command line for the loop, that is, to achieve BULK insert
2.4 Delete document Remove ()
Db.test.remove ({}) can delete all documents
2.5 Query documents Find (), FindOne ()
and conditional queries, or condition queries, and and and or can be used in conjunction
2.6 Pretty () to display all documents in a formatted manner
Well, it's over, I really don't want to write because I'm the front end. Hum, please ask the wrong.
You can learn on the rookie tutorial, which is more detailed.