Video Transcript (English)
Welcome back, team!
In this video, you’ll learn how to use your connection string with MongoDB Compass to connect to your cluster.
We’ll also take a quick tour of Compass, and show you how to use it to view and interact with your data.
MongoDB Compass is a graphical user interface, or GUIgooey, that allows us to query and analyze our data, and compose aggregation pipelines.
To get started, let’s log in to our Atlas account to access our project dashboard.
Once logged in, navigate to the Database tab.
You should see the clusters for the selected project. Click the Connect button.
On the next page, select the option to connect using MongoDB Compass.
This will bring up instructions for installing MongoDB Compass. Follow the instructions for your operating system. Or, if you already have Compass installed, skip to Step 2 and copy the connection string.
Next, open Compass.
There’s a New Connections tab, followed by Favorites and Recent.
We currently don’t have any connections saved. Let’s create one by clicking New Connections.
We’ll paste in the connection string that we copied into the text box labeled URI. Be sure to update the password in your connection string to the correct one. Atlas doesn’t do this automatically for security purposes.
Before connecting, let’s add this connection string to our Favorites by clicking the star icon.
This will open a prompt that allows us to assign the connection string a name and color of our choice.
Let’s call this connection “mdbu” and give it this stellar green color.
Then click the Save button.
Now we’ll see the connection is saved for easy access in the future.
Click Connect.
Once connected, we’ll be taken to this screen that has three tabs at the top: My Queries, Database, and Performance.
In the My Queries tab, we can save queries for later use.
The Database tab shows all the databases on our cluster. The databases are also listed on the left-hand side.
This tab also allows us to create a new database.
Finally, the Performance tab monitors various metrics of your database and queries. This tab is beyond the scope of this lesson, but you should know about it in case you ever need to monitor the performance of your database.
Now, let’s open the sample_analytics database, which is listed on the left side of the screen. When we click it, we’ll see a list of the collections in the database.
We can explore the data in more detail by selecting a collection. Let’s select the accounts collection.
Once inside the collection, we can insert and query documents within it.
Notice the tabs above the list of documents.
The Aggregation tab is used for composing aggregation pipelines that can be exported to multiple programming languages.
The Schema tab is used to analyze the structure of your documents so that you can better understand your data.
Explain Plan is used for analyzing the performance of your queries.
The Indexes tab allows us to examine and create indexes in our collections to improve the performance of our queries.
Finally, Validations allow us to create rules to enforce the structure of documents on updates and inserts.
If these concepts are new to you, you'll be able to learn more about them as you become more familiar with Atlas and MongoDB.
Let’s recap what we learned in this video:
We learned that Compass is a graphical user interface that allows us to query data, compose aggregation pipelines, and analyze data.
We also learned how to use connection strings with Compass to connect to an Atlas cluster.
Nice work!