If you are using MongoDB in the Cloud (Atlas) Or if you plan on using a local instance of MongoDB, you will need to:
Install MongoDB and start up an instance to which you will connect.
To install Compass, see the Compass installation instructions
In order to connect to MongoDB, you will need a URI string. A URI (Uniform Resource Identifier) is similar to a URL.
in my case i use the server ip, where i deployed the mongodb and its cluster run in localhost (http://127.0.0.1:27017).
If you wish to manually configure your Compass connection, load Compass and select the New Connection link. You will see a form where you can enter connection information for MongoDB.
in my case i use mongo-compass version 1.31
the host name define your mongoDB cluster-IP, you can see your cluster-IP in ubuntu on:
nano /etc/mongo.conf
if your mongo-DB is bind with some external or internal IP, then use this URL. in my case my server-IP is public and mongo is runing on internal local host (IP=127.0.0.1).
You will be prompted to populate the connection dialog. Click Yes.
NOTE Errors related to connecting through Compass will appear in red at the top of the Connect screen.
Congratulations. If you have successfully completed this guide, you have connected to your MongoDB instance. In the next group of guides, you’ll learn how to create, read, update, and delete data in MongoDB.
The default /etc/mongod.conf file has this entry for network interfaces:
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
To expose the database running in a VM to the host, it's simplest to bind the database to all interfaces for testing purposes.
# network interfaces
net:
port: 27017
bindIpAll: true
Notice the bindIp parameter is removed.