Window install MongoDB + some mongodb database commands

Configuration:

window10
python3.6

A write operation of mongodb:

1. Install MongoDB on Windows platform

1), download the mongodb installation package:

Official download address:

This is the window 10.64 bit installation software, you can download and install it directly: 4.2 version of the window64 bit download address

After entering, select the corresponding system and version:
Insert picture description here

2), installation steps:

I am lazy here, all the screenshots are installed, follow the steps in the picture to complete the fool-proof installation.

Remember to create a current folder yourself before installation, and use it later.

Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here

Choose the location of the installation directory you built here

Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here
Insert picture description here

Insert picture description here

3) Put the bin folder of the installation directory into the environment variable:

Insert picture description here

Insert picture description here

4), verify whether the installation is successful

At this time, open cmd, and enter mongo casually. The following represents success.
Insert picture description here

2. Install the mongodb management tool compass

1), download address:

Official download address

This is the address of the management software I use. You can download and install it directly: Window64-bit stable version installation software

Insert picture description here

2), installation steps:

Create a new directory, I create it here mongodb_tool:
Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here

Insert picture description here
Click it too fast, there is an install, just click install.
Insert picture description here

3), link database:

Insert picture description here

Insert picture description here

Insert picture description here

4) Use tools to build a database:

Insert picture description here

3. Mongodb replicates the database

1. Mongo or mongo --port 27017 enter the database:

mongo
mongo --port 27017

Among them: 27017 is the default port number of the mongodb database, this item should be present during installation, generally you don’t need to write it

2. Copy command:

db.copyDatabase("111_test_database_scrapyd_66ip","111_test_database_scrapyd_66ip3")

among them:

  1. 111_test_database_scrapyd_66ip is an existing database;
  2. 111_test_database_scrapyd_66ip3 is a database that does not yet exist. After the command is completed, a database with this name will be generated, and the data will be the same as 111_test_database_scrapyd_66ip.

3. Screenshot steps

Insert picture description here
Screenshot of the original database: A screenshot of the
Insert picture description here
copied database:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_42081389/article/details/102580738