Nodejs manipulating MongoDB

Source: Internet
Author: User

I. Console Operation MongoDB

1. Add environment variables after installation.

2. Under a new data folder under a root directory, create a new DB folder CD to c:/data/db.

3. Start MongoDB

Mongod.exe--dbpath c:\data\db

Print the following message stating that the connection was successful


At this point in the bin file into the MongoDB directory new open a CMD window clip to execute Mongo.exe
As shown below, you can manipulate the database at this point.
Insert a piece of data as follows and look for it.


4. Remember to start a window as a server and open another window to run Mongo.exe. If you run directly
Mongo.exe will print the following error.


5. Some common commands

(1) Show DBS View all databases

(2) DB View current database

(3) Use database name to switch to a database





Nodejs manipulating MongoDB

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.