MongoDB Configuration and Simple example

Source: Internet
Author: User

Installation

Download and install https://www.mongodb.com/on official website

Configuration

My Computer, right-click Properties, Advanced Program settings, environment variables in the list on the left

  

Click Path

  

Put your MongoDB file path in the line below

  

Default path: C:\Program files\mongodb\server\3.2\bin put inside Click OK

  

Note (Create a new data folder in the C packing directory, and then create a new DB in the database folder for your MongoDB)

Configuration

Open cmd

Use the path command first to see that MongoDB has successfully joined

  

  

Starting with the Mongod command

  

  

is re-opening a cmd

Enter command line MONGO to view the results

  

Successfully started. Default Database Test

  

Command line

  

DB  View Current database
Use Chenluomenggongzi using Chengluomenggongzi database, not automatically created
Db.users.insert ({name: "Morning Dream Son", Age: "521"})  insert users into the current database and deposit data
Db.users.find ()   querying data from users in the current database
Db.users.find ({name: "Morning Dream Childe"})  query name for the morning Dream Childe Information
Show database display databases

  

MongoDB Configuration and Simple example

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.