MongoDB Database Lab Test for Future Data Engineering Students
Objective:
This lab test is designed to assess your understanding and skills in MongoDB, particularly in CRUD (Create, Read, Update, Delete) operations using the MongoDB Shell.
You will create a database, and then create, modify, and interact with student records.
Part 1: Set Up Your Environment
Part 2: Create a Database and Student Records
1. **Create a Database**:
Create and switch to a new database named `studentRecords`.
2. Create Student Records
- You are required to create 20 student records in a collection named `students`.
- Each student record should be in the following format:
Use the provided JSON format to create individual student records. Here are the details for 5 students. You need to create 15 more on your own, ensuring variety in names, ages, majors, and enrollment years.
Use the pretty print function to display your records.
Screen shot these into the Word Document.
MongoDB Database Lab Test for Future Data Engineering Students
Part 2: Updating Student Records
Objective:
In this part of the lab test, you will demonstrate your ability to update existing documents in the MongoDB database. You will use various criteria, including greater than or equal to (`gte`) and less than or equal to (`lte`), to select documents for updating.
Explanation
This command selects students majoring in History who enrolled in or before 2019 and updates their enrollment year to 2023.
Submission Instructions:
1. Document Your Work: Include all the update commands you executed in your submission document.
2. Explain Your Steps: Provide explanations for each update command, detailing why and how the command updates the records.
Grading Criteria:
Your work will be evaluated on:
- The correct application of update operations.
- Proper use of query selectors like `gte` and `lte`.
- Clear and concise explanations for each operation.
- Adherence to the task requirements.
---
This part of the lab test will deepen your understanding of how to manipulate data in a MongoDB database effectively. It's a crucial skill in the world of data engineering, where data is not static but continually evolving. Good luck, and remember, precision in your commands is key!
Part 3: Submission Instructions
1. **Submit Your Commands**: Prepare a document with all the MongoDB commands you used to create the database, the collection, and the student records.
2. **Include a Brief Description**: For each step, write a short explanation of what the command does.
Include in your Word Document screen shots showing your MONGO DB terminal and DB Compass to show the data in your database.
Part 4: Grading Criteria
Your submission will be evaluated on the following:
- Correctness and execution of MongoDB commands.
- Adherence to the JSON format provided.
- Variety and realism in the student data you create.
- Clarity and accuracy of your explanations.
Part 3: Deleting Documents Based on Specific Criteria**
Objective:
In this section of the lab test, you will demonstrate your proficiency in deleting documents from the MongoDB database based on specific criteria. You will use various query selectors, including `gte` (greater than or equal to) and `lte` (less than or equal to), to identify the documents that need to be deleted.
Tasks:
Instructions for Printing and Submission:
1. Print Database Contents Before and After Deletions**:
- Before executing the delete commands, print the current state of your database.
```shell
db.students.find().forEach(printjson);
- After executing the delete commands, print the updated state of your database.
db.students.find().forEach(printjson);
Document Your Work**:
- Include screenshots of your MongoDB shell showing the contents of your database before and after the deletions in your submission document.
- Provide the delete commands and explanations for each in your document.
3. **Include a Reflective Summary**:
- Write a short summary of what you observed during the delete operations, including any challenges you faced and how you resolved them.
#### Grading Criteria:
Your submission will be evaluated on:
- Correct execution and application of delete operations.
- Accurate use of query selectors (`gte`, `lte`, etc.).
- Clarity and relevance of screenshots before and after deletions.
- Quality of explanations and reflective summary.
---
Through this exercise, you will gain hands-on experience in managing and manipulating data within a MongoDB database, particularly in understanding how deletions impact the dataset. This is a vital skill in data engineering, as maintaining data integrity and relevance is paramount. Good luck, and remember to capture each step of your journey!
This lab test will give you practical experience in managing data using MongoDB and enhance your understanding of database operations.
Good luck, and may you enjoy the journey as much as the destination in this exploration of data engineering!
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (