Skip to content

Connect to a MongoDB Flex instance

To compose the URI with your credentials, you need the username, the password, the instance ID and the region. The default region is eu01.

This is the composition template:

mongodb://<Username>:<password>@s-<Instance ID>-0.mongodb.<Region>.onstackit.cloud:27017/<Database>?authSource=<Database>&tls=true&authMechanism=SCRAM-SHA-256

This is an example for a connection URI:

mongodb://zvwn577e:S7ihJf9cbFdfzd7m@s-9092270d-c65a-45db-82bb-f259f3941f22-0.mongodb.eu01.onstackit.cloud:27017/books?authSource=books&tls=true&authMechanism=SCRAM-SHA-256

MongoDB Compass is a GUI for your local development environment. You can either download it on the official MongoDB website or install it with the sources of your operating system.

After installing and opening MongoDB Compass, you can connect to your database:

  1. Click on Add new connection.
  2. Paste the connection URI into the URI field.
  3. You can optionally enter a custom friendly name in the Name field.
  4. Click on Save & Connect.

If you have problems connecting to your instance, consult the Troubleshooting of MongoDB Flex article.