Access Your MongoDB® Database With Compass

MongoDB® Compass is the official GUI to manage MongoDB® database. It supports CRUD operations and offers nice visualization of your data. It is freely available on the MongoDB® website.

Databases hosted on Scalingo are not by default directly available on Internet. There are a couple of ways to get access to a Scalingo for MongoDB® database with MongoDB® Compass:

  • Connection via an Encrypted Tunnel
  • Connection via the DB Tunnel of our CLI
  • Connection with TLS

More information in the dedicated page.

Configuration of Compass

The connection URI can be found in the MONGO_URL environment variable of your application from the web dashboard or from the CLI:

$ scalingo --app my-app env-get MONGO_URL
mongodb://my-app-7093:EsEjseivpacatVoogfijbiapgadTyg@c393a9e3-42fe-4e33-9e6c-8ee815e9af88.my-app-7093.mongo.a.osc-fr1.scalingo-dbs.com:31312/my-app-7093?replicaSet=my-app-7093-rs0&ssl=true

In this case:

  • Hostname: c393a9e3-42fe-4e33-9e6c-8ee815e9af88.my-app-7093.mongo.a.osc-fr1.scalingo-dbs.com
  • Port: 31312
  • User: my-app-7093
  • Password: EsEjseivpacatVoogfijbiapgadTyg
  • Database: my-app-7093

Connection via an Encrypted Tunnel

Open MongoDB® Compass, then click on “New Connection”. After that click on “Advanced Connection Options” and fill the fields accordingly:

  • General
    • Connection String Scheme: mongodb
    • Host: c393a9e3-42fe-4e33-9e6c-8ee815e9af88.my-app-7093.mongo.a.osc-fr1. scalingo-dbs.com:31312 (Hostname + Port)
  • Authentication
    • Authentication Method: Username / Password
    • Authentication Mechanism: Default
  • TLS/SSL
    • SSL/TLS Connection: On
    • Certificate Authority (.pem): Depends on the region where your database is hosted. You can find URLs of our CA certificates at the end of this page and use it here.
  • Proxy/SSH Tunnel
    • SSH Tunnel/Proxy Method: SSH with Identity File
    • SSH Hostname/SSH Port/SSH Username: Depends on the region where your database is hosted. You can find all information at the end of this page and use it here.
    • SSH Identity File: Your private SSH key linked to the public SSH key you uploaded on the SSH Keys page of the Scalingo dashboard.
  • Advanced
    • Read Preference: Default

Connection via the DB Tunnel of our CLI

You can also use another method, that consist to create an Encrypted Tunnel with our CLI. Then in MongoDB® Compass to connect into the database with a local address which correspond to the DB Tunnel.

Let’s open a DB Tunnel with the Scalingo CLI:

$ scalingo --app my-app db-tunnel SCALINGO_MONGO_URL
Building tunnel to c393a9e3-42fe-4e33-9e6c-8ee815e9af88.my-app-7093.mongo.a.osc-fr1.scalingo-dbs.com:31312
You can access your database on:
127.0.0.1:10000

Open MongoDB® Compass, then click on “New Connection”. After that click on “Advanced Connection Options” and fill the fields accordingly:

  • General
    • Connection String Scheme: mongodb
    • Host: 127.0.0.1:10000 (Hostname + Port)
    • Direct Connection: Yes
  • Authentication
    • Authentication Method: Username / Password
    • Authentication Mechanism: Default
  • TLS/SSL
    • SSL/TLS Connection: Default
  • Proxy/SSH Tunnel
    • SSH Tunnel/Proxy Method: None
  • Advanced
    • Read Preference: Default

Connection with TLS

As a replacement to using an encrypted tunnel to connect to your database, you can make it available on the internet from your database dashboard. You must activate the Internet Accessibility.

Open MongoDB® Compass, then click on “New Connection”. After that click on “Advanced Connection Options” and fill the fields accordingly:

  • General
    • Connection String Scheme: mongodb
    • Host: c393a9e3-42fe-4e33-9e6c-8ee815e9af88.my-app-7093.mongo.a.osc-fr1.scalingo-dbs.com:31312 (Hostname + Port)
  • Authentication
    • Authentication Method: Username / Password
    • Authentication Mechanism: Default
  • TLS/SSL
    • SSL/TLS Connection: On
    • Certificate Authority (.pem): Depends on the region where your database is hosted. You can find URLs of our CA certificates at the end of this page and use it here.
  • Proxy/SSH Tunnel
    • SSH Tunnel/Proxy Method: None
  • Advanced
    • Read Preference: Default

Common issues

topology type: unknown is not writable

If your plan has a single node replica, you might see the error topology type: unknown is not writable in MongoDB® Compass. In such case, you should leave the field “Replica Set Name” from “Advanced” section empty.

Authentication Information

SSH Endpoints

  • osc-fr1: ssh.osc-fr1.scalingo.com
  • osc-secnum-fr1: ssh.osc-secnum-fr1.scalingo.com

CA Certificates

The Certificate Authority for databases hosted on Scalingo is downloadable here:


Suggest edits

Access Your MongoDB® Database With Compass

©2024 Scalingo