mLab and Studio 3T logos

mLab is the leading Database-as-a-Service for MongoDB, powering over half a million deployments worldwide. Trusted by companies such as Lyft, Facebook, and Whole Foods. Studio 3T is a graphical user interface and IDE for MongoDB.

Among other things, it allows you to explore your data in a more intuitive way and simplifies complex queries through its query tools.

In this post you will learn

  • how to setup a cluster with mLab
  • how to connect your mLab database to Studio 3T
  • where to go to learn more about working with Studio 3T

Set up a Cloud Cluster

This section will guide you through setting up a free Sandbox. A free Sandbox deployment which offers a single node with 500 MB of storage.

  1. Click on Create New in the MongoDB Deployments section of your home screen.
  2. Select a cloud provider and the free Sandbox plan type. Then click on the Continue button.
  3. Select the region that is closest to you. Then click on the Continue button. Note: For production environments your application and your database should be co-located.
  4. Enter a name for your database. Then click on the Continue button.

After reviewing your selections click on Submit Order.

Screencast of a user creating a deployment on mLab. The user clicks on 'Create New' in the MongoDB Deployments section of their home screen. The user then selects AWS as their cloud provider and the free Sandbox plan type. Then the user clicks the 'continue' button on the bottom right corner. The user selects the 'us-east-1' region and clicks the 'continue' button. The user enters a random name in the database name form field and clicks the 'continue' button. Finally the user clicks 'submit order'.

Obtain the Connection URI

On your mLab home screen, click on the database you want to connect to (if you have a cluster, you will have to first click on the cluster, and then select the database). At the top of the screen of your database you will see a URI of the form:
mongodb://:@ds012345.mlab.com:12345/database-name or mongodb://:@ds012345-a0.mlab.com:12345,ds112345-a1.mlab.com:12345/?replicaSet=rs-ds112345
You need a username and password to replace the placeholders and within this the string.

To create a user, click on the ‘Users’ tab and click the ‘Add database user’ button. Do not select the ‘Make read-only’ option as you need a user that can write to the database.

Screencast of a user creating a user for a database on mLab. First the user navigates to a test-database from the mLab home screen. From there, the user clicks on the `Users` tab and then on the `Add database user` button. In the dialogue that opens the user types in a username and a password and clicks on `create`. On the final bit the database overview is shown where the user has been successfully created.

Connect to Studio 3T

If you haven’t yet, go ahead and download Studio 3T and install it. You will need the connection URI string from your database in the following steps. It should be of the form:
mongodb://:@ds012345.mlab.com:12345/database-name

  1. Inside Studio 3T, click on Connect in the top left corner of the toolbar.
  2. Inside the Connection Manager that opens up, click on New Connection in the top left corner of the toolbar.
  3. Inside the new connection window that opens, give your connection a name. Then click on From URI… in the bottom of the window.
  4. Paste your connection URI (ensure you replace the placeholders with your username and password) and click on Ok.
  5. To confirm Studio 3T extracted everything correctly, you can verify the information in the Server, Authentication, and SSL tabs. Once you are satisfied click Save.
  6. Lastly, select the connection you just created and connect to it.

Screencast of a user connecting to their mLab deployment from Studio 3T. The user starts on the mLab Database overview screen and copies the connection URI at the top of the screen. Then the user opens up Studio 3T and clicks on `Connect` in the top left corner of the toolbar. A new window opens that shows the Connection Manager. On there the user clicks on `New Connection` in the top left corner. In dialogue that opens, the user enters 'mLab Example' as the connection name in the first field and then clicks on `From URI...` at the bottom of the dialogue window. A new window opens that asks for a connection URI. The user pastes the connection URI they copied in the beginning and enters a username and password where the placeholders <dbuser> and <dbpassword> are. The user hten clicks on `Ok` and then on `Save` and lastly on `Connect`. Studio 3T then loads the requested database.

Now that you are all set up, let’s insert an example dataset:

  1. Either Copy the dataset into your clipboard or save it as a file.
  2. Inside Studio 3T, select your database and click on Import and import the JSON dataset either from your clipboard or by selecting the file you saved. If you copied the data from your clipboard be sure to add pokemon as the name of your collection.
  3. Click on Next twice and then on Start Import.

Screencast of a user importing a dataset into a database in Studio 3T. The user starts on the Studio 3T application with a database called test-database connected. The user selects this database and then clicks on the insert button in the top menu. A new window opens up that allows the user to select the format of the data that is to be imported. JSON is preselected so the user clicks next. On the next screen, the user then clicks the plus icon in the top left corner. Then the user chooses the file pokemon.json and clicks on open. The user clicks on next twice and then on start import. Now the user is back to the normal screen and clicks on the database and then double-clicks the pokemon collection. A new UI opens that shows the collection's documents and provides tooling to interact with the documents.

You now have a sample dataset and you’ll find your new collection located on the left hand side within the Connection Pane. Double-click your new collection and you’ll see the Collection Tab open up with all your collection’s documents. From here you can use the UI to add, edit, view, and delete documents. You also have access to the Visual Query Builder from here.

A screenshot highlighting the 'Collection Operations' buttons and the Visual Query Builder in Studio 3T.

To explore Studio 3T’s functionality further have a look at the three different ways to view your data or how to build complex queries using drag & drop fields. Our other favorites include the IntelliShell that offers auto-completion as you type and the SQL query tool.

Learn more

If you’re interested in hearing about other tutorials and MongoDB tips, follow mLab on Twitter @mlab.

Find useful Studio 3T tips and tricks by visiting the Studio 3T knowledge base.

Leave a Comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href=""> <abbr> <acronym> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>