MongoDB beginner (1): configuration environment, mongodb beginner
I. mongoDB Installation
1. First download the installation package http://www.mongodb.org/on the official MongoDB website /. Download the SDK based on your operating system.
2. Create two directories on the hard disk to differentiate the mongoDB installation files and data files. For example, I have created the following directories:
D: \ mongodb and D: \ mongodbdata
Decompress the downloaded installation package and copy the decompressed content to D: \ mongodb.
3. Start CMD (win + R key, CMD) to switch to the bin folder in D: \ mongodb.
Run mongod.exe -- dbpath D: \ mongodbdata to install the database.
4. Configure environment variables. Add D: \ mongodb \ bin to path
5. You can enter mongod-help in CMD to view mongdb help.
Ii. Start the database
Create a bat file (enable the database file ):
Input content: mongod -- dbpath D: \ mongodbdata
Create a new bat file (Database Operation file ):
Input: mongo 127.0.0.1: 27017/admin
The port number for accessing the database through the URL 127.0.0.1 is 27017 (default port) and accessed by the admin user
Iii. database comparison
Iv. Simple database operations
1. Create a database use [dbName]
[DbName] indicates the name of the database. The database will not be saved if no operation is performed on the database after the database is created.
2. Add a set to the database (which can be understood as a new table) and add records (add data to the table)
Db. persons. insert ({name: "zhangsan "})
3. query all databases
Show dbs
4. query documents in the database
Show collections
5. query data in database documents
Use the find () method or findOne () method
6. Modify the database
Db. persons. update ({name: "extjs4.0" },{$ set: {name: "extjs4.1 "}})
Similar
Update persons set name = 'extjs4. 1 'where name = 'extjs4. 0'
7. delete data
Db. persons. remove ({name: "extjs4.0 "})
Example:
Dear colleagues, I am a beginner of android and have a question about the configuration of the android development environment.
If you are slow, the next version will be available. You just need to download the recommended package,
JSP for beginners. Let's teach you a question.
It is best not to use JBuilder in the early stage. This tool does not block some code. Specifically, the operation step replaces the code writing. Therefore, you do not understand many principles and the most basic code, it is not clear what functions are available and what functions are implemented, which is not conducive to preliminary learning. We recommend that you use eclipse or idea. In particular, the idea tool has a beautiful interface, easy to use, and comprehensive functions.