The above window downloads and installs the Mongodb database. We simply set up the Mongodb service
, but we also need a client.
Let’s start the server
mongod --dbpath=..\data\db
We then run a terminal as an administrator and
directly enter the bin of the Mongodb installation directory
. Then the command to start the client is mongo --host service ip --port service port.
The default is
mongo --host localhost --port 27017
Access port 27017 of this machine.
If you want to use this directly
mongo
It is also possible
, but the mongo command is no longer provided after MongoDB 4.4.
If it is a version after MongoDB 4.4, you can check my article to solve the problem that there is no mongo.exe file in the downloaded MongoDB bin directory.
Mongodb also has the concept of library.
According to the console output, we are currently under the test library
and we can enter
show dbs
It will output all the libraries we think of except the current database.
For example, if we want to enter the admin database, we can enter
use admin
In this way, we are currently in the admin database.