NavigationContentFooter
Jump toSuggest an edit

Managed MongoDB® Databases - Quickstart

Reviewed on 12 September 2024Published on 12 September 2024
Important

Managed MongoDB® is currently in private beta. Click here to join the waiting list.

Managed MongoDB® Databases provide fully-managed document Database Instances, with MongoDB® as a database engine.

MongoDB® databases enable users to store and retrieve data in a document format, such as json. Compared to traditional relational databases where data is stored in a table-like format, document-type storage supports storing multiple nested keys and values in each document key.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • A MongoDB®-compatible client installed

How to create a Database Instance

  1. Click MongoDB® under Managed Databases on the side menu, if you do not have a Database Instance already created, the creation page displays.

  2. Click Create a Database Instance. The creation wizard displays.

  3. Complete the following steps in the wizard:

    • Select MongoDB® as a database engine.
    • Choose a region. This is the geographical location where your database will be deployed.
    • Select a replica set configuration. You can choose between:
      • Replica-set 1-node - an instance of MongoDB® that runs as a single server and does not provide redundancy or high availability.
      • Replica-set 3-nodes - a group of 3 MongoDB® servers (1 primary and 2 standby nodes) that maintain the same data set. Replica sets provide redundancy and high availability and are the basis for all production deployments. If the main node fails for any reason, one of the remaining standby nodes is assigned and can take over requests, reducing downtime.
    • Select a node type.
    • Define the size of your Block Storage volume. You can increase your storage space without changing your node type, with no downtime. You can increase your volume to up to 10 TB.
    • Add a name and set a password for your user.
    Important

    Your username must adhere to specific criteria.

    • Length must be between 1 and 63 characters
    • First character must be an alphabetic character (a-Za-Z)
    • It can not start with _rdb
    • Only a-zA-Z0-9_$- characters are accepted
    • Enter a name for your Database Instance.
  4. Click Create a Database Instance to confirm your choices and launch creation.

    You are taken to the Overview tab for your Database Instance.

How to connect via database client with mongosh

  1. Click MongoDB® under Managed Databases on the side menu. A list of your Database Instances displays.
  2. Click the database name or «See more Icon» > More info to access the Database Instance information page.
  3. Click «Download Icon» next to the TLS certificate to download it.
  4. Transfer the file to where you will execute the connection command.
  5. Return to the console and click Connect in the Connect Database Instance section.
  6. Select a connection mode. The following modes are available: mongosh, Python, Go, Node.js and Mongoose. In this tutorial we use mongosh.
  7. Replace the variables in the commands with your information.

Connect to a public endpoint

  1. Replace the following variables in the command as described:
    mongosh "mongodb+srv://{instance_id}.mgdb.{region}.scw.cloud" --tlsCAFile {your_certificate.pem} -u {username}
  • {your-certificate.pem} - the TLS certificate downloaded on step 3.
  • {username} - the username you defined upon Database Instance creation.
  • {db-instance-id} - the UUID of your Database Instance.
  • {region} - the database name you entered upon Database Instance creation. The default is called rdb.
2. Run the command.
3. Enter your password when prompted.
If the connection is successful, you should see the following message display on your console, and be able to write queries:
```sh
The server generated these startup warnings when booting
Powered by MongoDB® v0.9.0 and PostgreSQL 14.6.

Connect to a private endpoint

Follow the same procedure as above to connect to a private endpoint for one node, replacing {privateNetorkName} with the name of your Private Network:

mongosh "mongodb://{instance_id}-0.{privateNetworkName}" -u {username}

Connect to a private endpoint with mulitple nodes

For multiple nodes, replace {db-instance-id} with the Database Instance UUID of each respective Instance, and {privateNetworkName} with the names of your Private Network:

"mongodb://{instance_id}-0.{privateNetworkName},{instance_id}-1.{privateNetworkName},{instance_id}-2.{privateNetworkName}" -u {username}
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway