In this exercise, you’ll create the pubs database and then import the document data in the british_pubs.csv file to the
british_pubs collection. You’ll then review the collection to verify that the document data has been properly imported into Studio 3T.
Download the british_pubs.csv file here.
If you’ve already created the pubs database and the welsh_pubs collection from the previous section, skip to step 4.
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.
Studio 3T adds the pubs database node to the Connection Tree.
Studio 3T adds the CSV Import tab to the main window. The tab includes two subtabs, Source options and Target options, as shown in the following figure.
After you add the file path, the Source options tab displays a preview of the first 100 documents.
The tab includes options for configuring the document data, as shown in the following figure.
This ensures that each document includes only those fields that contain actual values, as opposed to null values. For example, a document won’t include the
phone field if the value is null.
Studio 3T removes the fields from the JSON output preview window and excludes the fields from the imported data.
The Target Options tab should now look like this:
Studio 3T creates the
british_pubs collection and imports the documents into the collection.
If prompted to save changes, click Discard changes.
british_pubscollection node to open the collection in a collection tab.
Studio 3T should have imported 51,778 documents, each describing a British pub.
british_pubscollection tab open for the next exercise.
In addition to importing files, Studio 3T also lets you import by copying data from a file and pasting it into a collection, as you have seen in Exercise 1 of Working with Document Data.