MongoDB Shell Common Commands

Source: Internet
Author: User
Tags mongodb server

MongoDB is a very popular NoSQL database management system, officially: MongoDB,

I installed in localhost is the Enterprise Server version, the default installation file directory is: C:\Program files\mongodb\server\3.2\bin, click Windows+r, enter cmd, start command Prompt, go to the installation directory

Every time you open command prompt you need to enter the installation directory of MongoDB is very troublesome, you can modify the computer environment Variables, right click this pc->properties, click Advanced System Setting->environment Variables, open the Environment Variables form, modify the path system variable, append "C:\Program files\" to the string of the path variable Mongodb\server\3.2\bin ", note between two paths with"; " Segmentation.

1. Enable the database server

Mongod start the database server and listen for 27017 port.

Mongod

2, link to database on database server

MONGO start MongoDB Shell,shell will automatically connect to the MongoDB server, you must ensure that Mongod is started.

The MONGO command has a parameter that is used to remotely connect to the database on the specified server.

MONGO Server-name/db-name

3. View the current connected DB

Use the DB command to view the database being connected

Db

4. View the DB and collection in the server

Show Dbsshow Collections

5, Switch DB

Use Foo

6, help command

Help

DB.HELP () Viewing database-level Help
Db.foo.help () Viewing collection-level help

MongoDB Shell Common Commands

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.