How to connect mongoDB Atlas with mongosh Shell In easy steps

In an Easy meaningful way, we are going to Connect MongoDB Atlas with localhost mongosh Shell

Especially for For Window system users


Be free till create cluster on MongoDB Atlas.
Now Click on > Connect > Choose one of “I do not have the MongoDB Shell installed” or “I have the MongoDB Shell installed”

Download “mongosh” on your dedicated system to choose system profile and version > click on “Download mongosh(Your_Version)”


Add <your mongosh’s download directory>/bin to your $PATH variable

For this make a outer folder on C:\ Drive with “MongoDB” name (not in "C:\Program Files")
Extract your mongosh setup


Search or Go to “Edit the system environment variables” > Environment Variables > Double click on “Path” > Create New > Paste “C:\mongoDB\mongosh-1.0.0-win32-x64\bin” > ok > Apply > ok

“Till now you setup your mongosh bin path in Environment Path variables” OK


Open commad prompt > Paste “mongo “mongodb+srv://” --username Rakesh-PC” >
Enter Your database Password


  • Replace myFirstDatabase with the name of the database that connections will use by default. You will be prompted for the password for the Database User, Rakesh-PC

  • If you don’t created database yet, Dont worry ! Connect with bydefault database “myFirstDatabase” You may create a new database later and replace this database to other, its your choice


Now You see message like this, which means you are connected from MongoDB Atlas db to mongosh Shell

connecting to: mongodb://, cluster0-shard-00-01.1olaw.mongodb .net:27017,cluster0-shard-00-0 t:270 17/myFirstDatabase5 authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-8ipxy8-shard-0&ssl=true

Implicit session: session { “id” : UUID(“c37l503a-3074-486h-ae5e-c7a283936d41”) }
MongoDB server version: 4.4.6
MongoDB Enterprise atlas-8ipxy8-shard-0:PRIMARY> show dbs

------------------------------------------For More ----------------------------------------------------------------
What is Organization in MongoDB Atlas
An organization can contain multiple projects (previously referred to as groups). Under this hierarchy structure:

  • Billing happens at the organization level while preserving visibility into usage in each project.
  • You can view all projects within an organization.
  • You can use teams to bulk assign organization users to projects within the organization.
    When you create an organization, you are added as an Organization Owner for the organization.

What is This Cluster0 left side of connect
Cluster0 is visible under Database option and left side of connect. And under this you can see three or more clusters series as primary, and secondary cluster

so In the context of MongoDB, cluster is the word usually used for either a replica set or a sharded cluster . A replica set is the replication of a group of MongoDB servers that hold copies of the same data over multiple clusters set as primary and secondary clusters on the priority based. This is a security and back plan provided by dbms services to prevent from and loses like, destroy database data from fire, broken, expiary etc. This is a fundamental property for production deployments as it ensures high availability and redundancy, which are crucial features to have in place in case of failovers and planned maintenance periods.

I hope this article forum helps you… Please write your review. Because I believe in learn with helping community and grow

1 Like

Welcome for the initiative to help community

Couple of points
1.In the writeup you downloaded mongosh but in the command you are using mongo
Add few words on mong vs mongosh
2.You have added double quotes at begin of mongo.Check this
3.You have put your clusterid/cluster name in the connect string.Mask it and explain how you got it from connect page and mention that it needs to be replaced with users own cluster id/cluster name


Thanks for your valuable support. I will.

A post was split to a new topic: I am trying to get stats (db.stats()) it returns all “0”