Node MongoDB database opens and operates

Source: Internet
Author: User
Tags mongodb

After installing the MONGO database in the installation database of the drive letter, such as the C disk new folder called MONGOs such as C:\mongos

Open the first Small black window input Mongod-storageengine Mmapv1-dbpath C:\mongos This is the warehouse of the database

Open a second small black window input MONGO

See the admin.0 and local.0 appear in the C-drive MONGOs folder to indicate that they have been installed.

1. View the database

Show DBS------View the database

2, using and creating a database there is no right to create

Use students-----into the database

3, view collection (table)

Show Collections---View collections in the Database (table)

4, creating a collection (table)

Db. The set name is entered without creating a db.xuehao------Create a collection (table)

5, add a data Db.xuehao.insert ({"num": "20180809"})

Db. Collection. Insert ({})

6, important Import data (import multiple data) as the data is imported into the database it is created successfully inside the collection (table) also created successfully

First, CTRL c disconnects the database

Step two, create a new TXT file outside the content as follows: multiple data

For example: Create a new A.txt file in the D disk with the following contents:

{"src": "Http://127.0.0.1/image/c6.jpg"}
{"src": "Http://127.0.0.1/image/c8.jpg"}
{"src": "Http://127.0.0.1/image/c9.jpg"}

Third, in the case of ensuring that the database warehouse is open: Open the Data Warehouse mongod-storageengine Mmapv1-dbpath C:\mongos This is the repository of the database

And open a little black window. Input: Mongoimport--db shujukuming--collections biaoming--drop--file d:/a.txt

The upper d:/a.txt can be dragged directly to the small black window.

This creates a new database named Shujukuming (table) named Biaoming and imports the contents of the file inside the a.txt.

6,

View all data under collection-----db.xuehao.find ()

Db. Collection. Find ()

Node MongoDB database opens and operates

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.