CS 374: Database Systems
James Madison University, Spring 2022

Apr 12: MongoDB Tutorial (Doc-Based)

Lesson Outline

15 min GP5 Advice
* Demo of last year's projects (take notes / ideas)
* Would I be able to clone and run your project?
* If the server crashed, would you lose anything?
* Keep updating all three folders with changes:
   schema, queries, webapp (README files)
30 min Ch11 Slides
* Quick review of Consistent Hashing, BASE
* Slides 33–38: Tuple and Document Stores
* Slides 39–43: Filters and Queries (Example 1)
* Slides 44–53: Complex Queries / MapReduce
* Slides 54–63: MongoDB Aggregation (Example 2)
30 min Lab Activity
* See instructions below
* Start working on HW7

Before Thursday

  1. Textbook: Read PDBM 11.3--11.4 (18 pages).

  2. Homework: Work on HW7 (due Sunday).

  3. Project: Work on GP5 (due next week).


MongoDB Tutorial

Quick Links

Step 1: Explore MongoDB Website

"MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need." Spend a few minutes reading through the What is MongoDB? page. Discuss its contents with members of your group.

Open the two "Quick Links" above in separate browser tabs. For conveneince, drag them into another window, and arrange your screen to see everything (e.g., put this page on the left, and put the documentation and reference on the right).

Step 2: Create, Read, Insert, Delete

Work through the first half of the "MongoDB CRUD Operations" section of the manual, starting from the beginning and ending with the "SQL to MongoDB Mapping Chart". There is no need to download and install anything on your computer. The manual itself provides a "web shell" in which you can run the examples.

Save the more interesting queries you write, along with comments explaining them, in a file named HW7Lab.mongo for future reference. You will turn in some of these queries as part of the homework assignment.