MongoDB Getting Started parsing "learning record"

Source: Internet
Author: User

Just started to learn MongoDB, made a collation of notes. is based on Nodejs to learn.

1.mongodb Introduction

MongoDB is written in the C + + language and is an open source database system based on distributed file storage. In the case of high load, adding more nodes can guarantee the performance of the server.

MongoDB is designed to provide scalable, high-performance data storage solutions for Web applications.

MongoDB stores data as a document and data structures consist of key-value (key=>value) pairs. A MongoDB document is similar to a JSON object. Field values can contain other documents, arrays, and array of documents.

{   username:"ABCD",   passwd: "$"}
2. Installing MongoDB

Installation package Address: Https://pan.baidu.com/s/1eRC1VxS

Click on the default installation after downloading

3. Create a Data Catalog

MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete.

The data directory should be placed in the root directory as mine in the E-Disk db folder (C:\DB).

4. Running the server

(1) Find the installation path of MongoDB, mine is the default path. Open the cmd command window here.

(2) Command Window input

Mongdo.exe--dbpath E:\db

(3) Click Enter to appear the following information on success, if the error input dir confirm the file in the directory.

(4) Management of the backstage

Open the Bin directory under the MongoDB directory, and then double-click the Execute Mongo.exe file.

5. Simple command of database operation

(1) Querying current data

Show DBS

(2) Create a data

If the members data sheet is switched on, no members are created.

Use Members

(3) "Use" command, you can connect to a specified database. "DB" to query the current database

(4) query data, find () can add conditions

Db.members.find ()

(5) Add data Insert ()

Db.members.insert ({" field ":" value "})

(6) Modify Data Update ()

Db.members.update ({Query Index}, {$set: {Modified value}});

(7) Delete data remove ()

Db.members.remove ({index})

6. Summary

(1) MongoDB is stored in physical memory relative to MySQL data and can be read and written more quickly.

(2) MongoDB is a JSON storage format. Good affinity for data storage and querying in document format.

(3) MongoDB is non-relational. Just start learning less suited, compared to some environments can choose MySQL.

MongoDB Getting Started parsing "learning record"

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.