MongoDB installation and simple use

Source: Internet
Author: User
Tags install mongodb



Install
1. Create a mongodb folder

Create a new mongodb folder, and create a data folder for mongodb as a database


2. Install mongodb

Unlike installing SQL, install mongodb by executing the cmd command.

Run the cmd command

A. Find the bin in the file directory.

B. Deploy it using an engine in the binfile



Dbpath is the address of our mongodb database.



The installation is successful.

Default 27017 Port

Enter localhost: 27017 in the browser.


You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number


We can see that this statement proves that mongodb is successfully installed.


3. Set window environment variables


The path of the execution file in the extracted binfile is directly placed in the environment variable, so that we can directly access all the programs through cmd.



 

4. bat file


Start mongodb Service

 

My batch files: http://pan.baidu.com/s/1i3ql7bZ


Easy to use


1. Create a database

Use [databaseName]

This is only a database cache pool. If you leave this empty database, it will be deleted.


2. view all databases


Show dbs


3. Add a set to the specified database and add records



4. view all documents in the database


Show collections


5. Update document data


Db. person. update ({name: "clm" },{ $ set: {name: "czs "}})


 



6. delete a set in the database

Db. [document]. drop ()

7. delete a database

Db. dropdatabase


8. help displays all database operations
9. Database and set command specifications


10. mongoDB's shell built-in js engine can directly execute j code




Summary


The above is a rough understanding of mongodb, and you need to contact the specific instance for specific use.


Related Article

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.