How to Install Mongdb4.X in Windows

The installation
windows
After the installation is complete, locate the data directory under the installation directory and create a folder named db in the data directory

Open the cmd command line, move the directory to the bin directory under the MongoDB installation directory, and enter the command
mongod --dbpath <dblocations>
mongod --dbpath D:\MongoDB\data\db

Open your browser and enter the address

http://localhost:27017

The following is a success

It looks like you are trying to access MongoDB over HTTP on the native driver port.

Open the service
Go to the bin directory under the installation directory
perform

-> mongod *--dbpath D:\MongoDB\data\db*
-> mongo   or    mongo --host=127.0.0.1 --port=27017
-> show databases;   //If you see the database information, it is successful


Read More: