I had faced this issue today and later I found that it was a set up problem. If you are also facing this issue while you set up MongoDB for the first time, following steps may help you. Make sure that MongoDB
service has been started in services.msc
.
- Go to C drive and create a folder
db
in the pathC:\data\db
, if you don’t seedata
folder in C drive, please create it first and thendb
folder as @sebastian mentioned in the comment. - Go the folder, where you had installed MongoDB, in my case, it was
C:\Program Files\MongoDB\Server\3.6\bin
- Type the command
C:\Program Files\MongoDB\Server\3.6\bin>mongod
- This will set up the MongoDB on your machine, and you will get an output as preceding.
C:\Program Files\MongoDB\Server\3.6\bin>mongod 2018-03-11T07:02:56.558-0700 I CONTROL [initandlisten] MongoDB starting : pid=18720 port=27017 dbpath=C:\data\db\ 64-bit host=SibeeshVenu 2018-03-11T07:02:56.558-0700 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
- Now if you try connecting, you may not be getting the issue.
![](https://readforlearn.com/wp-content/uploads/2021/12/Cp6hB-1024x661.jpg)