MongoDB - Connect with MongoDB Compass
Connect to your Public Cloud Databases for MongoDB using MongoDB Compass
Connect to your Public Cloud Databases for MongoDB using MongoDB Compass
Last updated February 20th 2022
Public Cloud Databases allow you to focus on building and deploying cloud applications while OVHcloud takes care of the database infrastructure and maintenance in operational conditions.
This guide explains how to connect to a MongoDB database instance with one of the world's most famous Open Source (SSPL) management tool for MongoDB: MongoDB Compass.
A MongoDB instance can be managed through multiple ways. One of the easiest, yet powerful, is to use a Command Line Interface (CLI), as shown in our guide: Connect to MongoDB with CLI or by using programming languages, such as PHP or Python.
Another way is to interact directly using a management tool for MongoDB: MongoDB Compass.
In order to do so, we will need to install MongoDB Compass, then configure our Public Cloud Databases for MongoDB instances to accept incoming connections, and finally configure MongoDB.
Pleese follow the official documentation to install MongoDB Compass.
We are now ready to learn how to connect to our MongoDB instance.
Before making a connection, we need to verify that our MongoDB instance is correctly configured.
Log in to your OVHcloud Control Panel and open your Public Cloud
project. Click on Databases
in the left-hand navigation bar and select your MongoDB instance.
Select the Users
tab. Verify that you have a user with sufficient rights and a configured password. If you don't remember the user's password, you can either create a new user or regenerate the password of an existing user. Be careful! By doing so you will need to update all the places where you already use this user/password pair.
We provide official MongoDB built-in roles. Please read the official MongoDB documentation to select the right roles for your use case.
In our example, we will create a user called userCompass with the roles readWriteAnyDatabase and userAdminAnyDatabase.
Once created or updated, note the password then after a few seconds check to verify the user is ready and with the "Enabled" status in the OVHcloud Control Panel.
In this step, select the Authorised IP's
tab (Access Control List).
By default, a Public Cloud Database does not accept any form of connection from the outside world.
This way we can help prevent intrusive connection attempts.
Click to authorise a new IP. In our case we will enter 109.190.200.59:
If you want to allow any connections from the outside, you can enter the IP 0.0.0.0/0. Please use it carefully. Every IP will be authorised.
Select the General Information
tab. In the Login Information section, copy the Service URI.
It should be similar to this when you have a single node (Essential service plan):
mongodb://<username>:<password>@<hostname>/admin?tls=true
And like this when you have a MongoDB cluster with multiple nodes, called a replica set (Business or Enterprise service plans):
mongodb://<username>:<password>@<hostname node1>,<hostname node 2>,<hostname node 3>/admin?replicaSet=replicaset&tls=true
In MongoDB Compass fill in the connection field with the Service URI
:
Now you are now interact with your Public Cloud Databases for MongoDB:
Explore the documentation to view all the features and how to interact with your data.
Managing a MongoDB service from the OVHcloud Control Panel
Configuring vRack for Public Cloud
Join our community of users on https://community.ovh.com/en/.
We would love to help answer questions and appreciate any feedback you may have.
Are you on Discord? Connect to our channel at https://discord.gg/PwPqWUpN8G and interact directly with the team that builds our databases service!
Si lo desea, también puede enviarnos sus sugerencias para ayudarnos a mejorar nuestra documentación.
Imágenes, contenido, estructura...: ayúdenos a mejorar nuestra documentación con sus sugerencias.
No podemos tratar sus solicitudes de asistencia a través de este formulario. Para ello, haga clic en "Crear un tíquet" .
¡Gracias! Tendremos en cuenta su opinión.
¡Acceda al espacio de la OVHcloud Community! Resuelva sus dudas, busque información, publique contenido e interactúe con otros miembros de la comunidad.
Discuss with the OVHcloud community