Introduction
This tip is related to MongoDB. You must be thinking why I wrote this tip if there are already videos and articles related to "How to connect MongoShell to Atlas cluster." Yes absolutely, there are multiple articles related to that but when I tried to do it on Windows 10, then I found it is a bit different on this platform and faced a lot of issues for which I didn't get good content which I can refer. Hence, I started writing this article so that it can help someone who is in the same situation. I hope it will help you.
Steps to Connect MongoShell to Atlas Cluster
- Download MongoShell from here.
- Run .msi file. After the successful run, it will create "MongoDB" named folder inside "Program Files" folder.
- Create mongod.cfg file and put in at the path (MongoDB/Server/3.4). The path may vary as per version. Paste the following content into the file:
systemLog:
destination:file
path:c:\Program Files\MongoDB\Server\3.4\data\log\mongod.log
storage:
dbPath:c:\Program Files\MongoDB\Server\3.4\data\db
Please note: If data folder and their subfolder and files are not present, then create them.
- Now open the command prompt as administrator and run the following command:
"c:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
--config "c:\Program Files\MongoDB\Server\3.4\mongod.cfg" --install
- Now to start the mongo DB server as a service, you can run the following command:
net start MongoDB
Please note: If "db" folder is not created inside "data" folder, then it will not start.
- Now to connect to cluster, change the working directory to the following path:
c:\Program Files\MongoDB\Server\3.4\bin
- Now paste the mongo shell command to connect to the cluster. (You can find command when you will create your cluster and logged in site. Then click on connect button. There, you will find command to connect to the cluster.