In Problem Set 5 and in lab, you will write queries for a MongoDB version of our movie database – one that uses the data model outlined in lecture.
Create a subfolder called ps5 within your
cs460 folder, and put all of the files for this assignment in that
folder.
Click on each of the following links, and save the files in
your ps5 folder:
If the browser doesn’t allow you to choose where to download the files, right-click each link and use Save link as... or the equivalent option.
Follow the appropriate set of instructions to get everything installed and properly configured:
Make sure that you have downloaded the files listed above and installed and configured the software.
Launch MongoDB Compass as needed. In the Connections panel, hover
your mouse over the one labeled localhost and click on its
Connect button.
If needed, click on the name of the localhost connection,
which should display the available databases for that
connection. Click the Create database button that appears
above the list of databases.
In the window that pops up, enter the following:
imdbmoviesand click Create Database. You do not need to import any data at this point.
As needed, choose the imdb database from the list of databases or
click on the imdb tab near the top of the window. You should
see an empty collection called movies.
After selecting the imdb tab, click Create collection and
create a new collection with the name people.
Repeat the same process to create a new collection with the
name oscars.
To add documents to the movies collection:
In MongoDB Compass, select the collection from the list of
collections for imdb.
Scroll down as needed to find the Import Data button and click it (NOT the Add Data one).
If needed, click Select a file.... (If you already see a pop-up window, this step isn’t needed.)
Choose the JSON file for the collection that you downloaded
above (e.g., for movies, the file is called movies.json).
Click Import. If needed, click DONE.
You should see that the collection now includes the documents that were found in the JSON file.
Repeat the same process to add documents to the oscars and
people collections.
Once you have everything installed and configured, you can perform queries by taking the following steps:
Launch MongoDB Compass.
If you are not yet connected, hover your mouse over the
connection labeled localhost and click on its Connect button.
If needed, click on the name of the localhost connection, which
should display the available databases for that connection –
including the imdb database that you created above. Click the
button labeled Open MongoDB shell that appears above the list of
databases. Doing so should open a new window labeled MONGOSH with
the following prompt:
test>
Enter the following command from the shell prompt:
use imdb
Note: You may need to hit the Enter/Return key twice in order for the command to be accepted. Once it is, the shell’s prompt should be changed to the following:
imdb>
Enter the appropriate method call for your query.
Note: You can allow your query to span multiple lines if you use Shift-Return or Shift-Enter at the end of a given line.
You should automatically see up to 20 result documents. If there are more than 20 results, you can enter the following command to continue iterating through them:
it
Last updated on November 19, 2025.