How to use Mongo Shell in the MongoDB database and use Navicat software to connect to MongoDB

What is Mongo Shell

Mongo Shell is a service provided by MongoDB that we can connect to MongoDB. It has built-in instructions about the database, and we can operate the database through instructions.

Use of Mongo Shell

First of all, we need to add mongo to the global environment of the computer.
My installation path is as follows: C:\Program Files\MongoDB\Server\5.0\bin
Then configure global variables: This computer-properties-advanced system settings-environment variables
and then in Create a new one in the path and copy the above installation path into it.

Then just open the command line tool and enter mongo to view the information
insert image description here
show dbs to view the current database
insert image description here

use admin Switch to the admin database,
enter db to view the current database environment,
enter exit; exit the current library, or use quit() to exit
insert image description here

Use Navicat software to connect to MongoDB

Go to the official website to download the Navicat Portal
and follow the steps to download and run

Click on the connection and select mongodb

insert image description here
Set the connection name and host port here, because it is local, so you can use the default one to
insert image description here
click on the connection, and then we can see the connection information on the right side
insert image description here
. We can create a new query and print out the result information

insert image description here
At this point, we can already use the visualization tool Navicat to connect to the MongoDB database. If you have any questions, you can communicate in the comment area, and we will continue to explain the basic knowledge of the MongoDB database later.

おすすめ

転載: blog.csdn.net/weixin_45745641/article/details/127188902