0% found this document useful (0 votes)
46 views2 pages

NoSQL Database Assignment Guide

1. The document describes an assignment for a Database Systems course to create a MongoDB database with a student collection containing 20 documents with sample fields. 2. Students must complete 16 tasks involving inserting, retrieving, updating, counting, and deleting documents using MongoDB commands in the CLI. 3. The first document must contain the submitter's real details, while other documents can have dummy data. Screenshots must be included in a report submitted before the deadline.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

NoSQL Database Assignment Guide

1. The document describes an assignment for a Database Systems course to create a MongoDB database with a student collection containing 20 documents with sample fields. 2. Students must complete 16 tasks involving inserting, retrieving, updating, counting, and deleting documents using MongoDB commands in the CLI. 3. The first document must contain the submitter's real details, while other documents can have dummy data. Screenshots must be included in a report submitted before the deadline.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Department of Electrical and Information Engineering

Faculty of Engineering, University of Ruhuna

EE4202: DATABASE SYSTEMS - NoSQL ASSIGNMENT


Task
Create a NoSQL database (document database) using MongoDB to store student
(collection) data. The sample document format is given in figure 01. The student collection
should contain 20 documents. Then write queries and complete the following tasks.

1. Insert 20 documents into the student collection


2. Retrieve the first document (should contain your data. i.e. name and reg_no)
3. Retrieve specific documents from the collection by _id
4. Retrieve students whose specialization is ‘Software’
5. Retrieve students whose city is ‘Gampaha’
6. Retrieve student whose specialization is ‘Software’ and gender is ‘F’
7. Retrieve only the reg_no of all students
8. Retrieve only first name, last name and specialization of all students
9. Retrieve only reg_no and address of who was born after 2000
10. Retrieve only the first name and modules of those who were born on or before 2000
11. Count the number of students who got an ‘A’ for ‘EE1202’
12. Count the number of students who got ‘B’ or ‘C’ for ‘EE2302’
13. Retrieve only reg_no of the students who have failed (‘F’) at least two modules
14. Delete all students who have failed (‘F’) at least two modules and get the count of
the remaining students
15. Update all the documents by adding a new field {status: ‘passed’} and
show the result.
16. Update your specialization (i.e first document) to a different field.

Department of Electrical and Information Engineering Faculty of Engineering, University of Ruhuna


{
name: {first:‘Supun’,middle:‘Kumara’,last:‘Perera’},
reg_no: ‘EG/xxxx/xxxx’,
gender:‘M’,
yearOfBirth:1999,
address: {no:‘20/2’, town:‘Hapugala’, city:‘Galle’},
specialization: ‘Electrical’,
modules:[
{code: ‘EE1202’,grade: ‘A’},
{code: ‘EE2301’,grade: ‘C’},
{code: ‘EE2302’,grade: ‘B’},
{code: ‘EE3202’,grade: ‘C’}
]

}
Figure 01: Sample document
Note: You can add data members to the document given in figure 01 if required. But
you cannot remove any given data members.
Guidelines
● Install the MongoDB latest version to your PC and implement the given task only
using CLI (Command Line Interface) or shell.
● Do not use any GUI applications (ex: MongoDB Compass) to complete this
assignment.
● Take screenshots of each step including the installation and initialization steps
● The first document of the student collection should contain your details. (Only name
and register number are sufficient. Other fields can have dummy data).
● Other 19 documents can have dummy data
Submission
Make a report containing the approaches to completing each task with screenshots of
steps and results.
Submit the report (max. 20 pages PDF) to the given link in the LMS before the deadline.

Deadline: 19th Nov 2022 (Late submissions will not be accepted)

Department of Electrical and Information Engineering Faculty of Engineering, University of Ruhuna

Common questions

Powered by AI

Specific data retrieval tasks include retrieving the first document, retrieving documents by _id, finding students by specialization or city, counting students receiving specific grades in modules, and retrieving certain fields like reg_no or first name based on conditions such as year of birth .

The key tasks in managing a MongoDB document database include inserting documents into collections, retrieving documents based on specific criteria (such as _id, fields like specialization or city), counting documents that meet certain conditions (like grades in specific modules), and updating or deleting documents based on predefined criteria. For instance, retrieving students whose specialization is 'Software', counting students who got an 'A' for 'EE1202', and deleting records of students failing at least two modules are some of these tasks .

The assignment integrates real-world applicability by simulating data-management tasks that are common in software development environments, such as inserting, retrieving, updating, and deleting data. Tasks like managing students' information based on grades or modules mimic real-world database management scenarios, preparing students to handle similar responsibilities in professional settings .

Requiring students to document their query execution process with screenshots serves multiple purposes: it encourages students to thoroughly understand each step, provides a clear demonstration of completing the tasks, and creates an auditable trail that can be reviewed for accuracy and understanding, essentially combining learning with documentation and accountability .

Command line interaction is emphasized to ensure a foundational understanding of MongoDB's core functionalities without relying on visual aids provided by GUI applications. This method encourages learning the syntax and operations deeply, reinforcing a hands-on approach to executing commands and coding logic that is crucial for fully grasping database management concepts .

Requiring specific document formats ensures consistency in data structure, which is critical for efficiently running queries and analyses. It also aligns data storage with expected schema designs, facilitating straightforward query generation and ensuring the collection is usable for tasks such as filtering, sorting, and aggregate operations within MongoDB .

A synthetic approach to querying students born after or before certain years is used to demonstrate the ability to apply complex conditions in data retrieval. This type of query involves understanding how to use logical operators and conditions to filter data accurately, which reflects a significant aspect of effectively managing and utilizing database systems for insightful data analysis .

The assignment ensures data manipulation competency by requiring the insertion of 20 documents into the collection, followed by tasks like deleting students who failed at least two modules. This exercise demands proficiency in both inserting new data and effectively managing data lifecycle operations like deletion within the MongoDB environment .

The assignment emphasizes data retrieval and manipulation by requiring various queries to be executed using the MongoDB CLI, such as retrieving specific documents, counting based on conditions, and updating or deleting records. This approach highlights practical skills in interacting with databases via command line rather than through GUI applications, promoting a deeper understanding of database commands and their functionalities .

Records in the MongoDB database are to be updated by adding a new field 'status' with the value 'passed' to all documents. Additionally, there's a requirement to update the specialization field of the first document in the collection .

You might also like