Install MongoDB 4.0 Community Edition on Windows
Download the installer (.msi) from the MongoDB Download Center:
In the Version dropdown, select the version that corresponds to the latest MongoDB Server 4.0.
In the OS dropdown, Windows 64-bit X64 should be selected.
In the Package drop down, MSI should be selected.
Run the MongoDB installer.
Go to the downloads folder and double-click the MongoDB installer (.msi file).
Follow the MongoDB Community Edition installation wizard.
The wizard steps you through the installation of MongoDB and MongoDB Compass.
Choose Setup Type
You choose the Complete setup type. (If you choose the Custom installation option, you may specify which executables are installed and where)
Starting in MongoDB 4.0, you can set up MongoDB as a service during the install or just install the binaries.
Select Install MongoD as a Service MongoDB as a service.
Select either: Run the service as Network Service user (Default) This is a Windows user account that is built-in to Windows
For an existing local user account, specify a period (i.e. .) for the Account Domain and specify the Account Name and the Account Password for the user.
For an existing domain user, specify the Account Domain, the Account Name and the Account Password for that user.
Service Name. Specify the service name. Default name is MongoDB. If you already have a service with the specified name, you must choose another name.
Data Directory. Specify the data directory, which corresponds to the –dbpath. If the directory does not exist, the installer will create the directory and sets the directory access to the service user.
Log Directory. Specify the Log directory, which corresponds to the –logpath. If the directory does not exist, the installer will create the directory and sets the directory access to the service user.