MongoDB First Knowledge 1: Start MongoDB

Source: Internet
Author: User

MongoDB can be run as a network server, and clients can connect to the server and perform operations.

1. First, the user must download MongoDB and unzip, run the Mongod command to launch the instance

: Http://www.mongodb.org/downloads

Configure environment variables to facilitate shell command operations later

2. Launch an instance

Then we can start the DB instance through the Mongod command, the simplest way to start is:

Mongod–dbpath E://database/mongodb

After the command is executed, if the target folder is before the database object, it is automatically created and started, and if the directory already exists the database is started

PS:--auth indicates a secure boot, the user must log in to a valid account in order to be able to ask the database, the relevant security configuration subsequent to the

3. Working with the database through the shell

Run MONGO to start the shell

Execution MONGO equivalent to MONGO 127.0.0.1:27017

After successful execution, we can get the current shell version number and link to the test library by default

Execute db to view the current point to the database

Ps:admin System Internal Database

Basic operation of 4.shell

MongoDB comes with a JavaScript shell, and we can interact with the database through the shell using the command-line approach. Because the shell is a JavaScript parser, you can run arbitrary JavaScript code

1) Create a document insert

2) Read the document find

3) Updating the document update

MongoDB First Knowledge 1: Start MongoDB

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.