In this exercise, you will create a database named
pubs and a collection named
welsh_pubs. You will then import a set of documents from the welsh_pubs.json file, which contains document data about pubs in Wales.
You can download the welsh_pubs.json file here.
You will need a connection string or Uniform Resource Identifier (URI) to connect to MongoDB Atlas. If you haven’t generated a URI, go back to the previous exercise Setting Up MongoDB Atlas to set up an Atlas cluster, and refer to Step 8 of Configuring MongoDB Atlas to get the connection string. Be sure to replace the placeholder in the URI with your actual password.
When you create a database in Studio 3T, you’re basically adding a temporary node to the Connection Tree. MongoDB does not create the actual database or its files until you add your first collection.
Studio 3T adds the pubs database node to the Connection Tree.
Do not worry about the other collection settings at this time. Studio 3T opens the welsh_pubs collection tab, as shown in the following figure.
The collection tab is divided into two sections.
The top section is the query bar, which provides a form for querying the selected collection. By default, the query bar includes a basic query that returns all documents in the collection. You can minimize the query bar by clicking the arrow to the left of the Query text box.
The bottom section displays the results from query in the query bar when the collection contains data. The section includes three tabs: Result, Query Code, and Explain. For this tutorial, you need to be concerned only with the Result tab.
The tab should now display the first 50 documents in the result set.
The count should show 3,122 documents. This is a handy tool to know about for verifying the number of documents returned by the current query.
You’ve finished the exercise! Click on Test your skills to review what you’ve learned.