In this exercise, you will load and run the bios.js file.
Download the bios.js file here.
The file contains a set of commands that create a database named
BioData and add a collection to the database named
bios. The collection includes 10 documents that contain biographical information about 10 individuals, one document per individual.
The document data comes from a sample collection available through the MongoDB Server manual. You can use this dataset to learn about MongoDB and test its features.
Studio 3T adds the BioData database node to the Connection Tree.
4. In the Connection Tree, right-click on the database (BioData) and click Open IntelliShell.
Then, de-select the Retain previous result tabs button if selected.
This ensures that, for this exercise, the results are displayed on a single result tab.
<path>placeholder with the actual folder path:
Backslashes can be interpreted in different ways, often indicated by an escape character. When specifying the path, you might need to escape any backslashes by adding an additional backslash to each one.
For example, if you’re working in Windows and save the bios.js file to the folder C:\DataFiles\MongoDB, you would type the following command in the IntelliShell editor:
macOS, on the other hand, uses forward slashes. If saving to the same folder, you would type the following command:
load method loads and runs a script file, which in this case is bios.js.
This creates the bios collection.
Double-click the bios collection node to open the collection in its own tab.
The documents include the following fields:
_id fieldis a unique
Int32value that identifies the document.
name fieldis an embedded document that provides the individual’s first and last name, along with other names, if applicable.
birth fieldis a
Datevalue that indicates when the individual was born.
death fieldis a
Datevalue that indicates when the individual died.
contribs fieldis an array that lists the individual’s contributions to technology.
awards fieldis as an array in which each element is an embedded document that includes specific award information.
title fieldis a
Stringvalue that lists the individual’s title. Not all documents contain every field; however, each document includes at least the
contribsfields. Leave the bios collection tab open for now in case you want to reference the documents in later exercises to see how they’re constructed.