Question
USE MONGO DB FOR ALL QUESTIONS use('Store'); db.orders.insertMany([ { item: canvas, qty: 100, reviews: ['amazing', 'great', 'fantastic'], dateOrdered: new Date('2013-07-05')}, { item: journal, qty: 25,
USE MONGO DB FOR ALL QUESTIONS
use('Store'); db.orders.insertMany([ { item: "canvas", qty: 100, reviews: ['amazing', 'great', 'fantastic'], dateOrdered: new Date('2013-07-05')}, { item: "journal", qty: 25, reviews: ['good'], dateOrdered: new Date('2018-08-11')}, { item: "mat", qty: 85, reviews: ['good'], dateOrdered: new Date('2012-06-04')}, { item: "mousepad", qty: 25, reviews: ['alright'], dateOrdered: new Date('2019-04-05')}, { item: "notebook", qty: 50, reviews: ['fantastic'], dateOrdered: new Date('2021-02-05')}, { item: "paper", qty: 100, reviews: ['bad'], dateOrdered: new Date('2015-01-27')}, { item: "planner", qty: 75, reviews: ['excellent'], dateOrdered: new Date('2017-03-14')}, { item: "postcard", qty: 45, reviews: ['good', 'terrible'], dateOrdered: new Date('2018-09-12')}, { item: "sketchbook", qty: 80, reviews: ['okay', 'great'], dateOrdered: new Date('2016-07-17')}, { item: "sketch pad", qty: 95, reviews: ['alright'], dateOrdered: new Date('2014-04-05')} ]); use('University') db.profs.insertMany([ { profName: 'Dr. Naser', dept: 'Software Engineering', teachingCourses: ['ESOF-3050', 'ESOF-2570']}, { profName: 'Dr. Akilan', dept: 'Software Engineering', teachingCourses: ['ESOF-4559', 'ESOF-4011']}, { profName: 'Dr. Smith', dept: 'Math', teachingCourses: ['MATH-1001', 'MATH-2001']}, ]); db.courses.insertMany([ { courseCode: 'ESOF-3050', courseName: 'Software Engineering Design', semester: 'Fall'}, { courseCode: 'ESOF-2570', courseName: 'Object Oriented Programmng', semester: 'Winter'}, { courseCode: 'ESOF-4559', courseName: 'Digital Signal and Image Processing', semester: 'Fall'}, { courseCode: 'ESOF-4011', courseName: 'Applied Computational Intelligence', semester: 'Winter'}, { courseCode: 'MATH-1001', courseName: 'Calculus', semester: 'Fall'}, { courseCode: 'MATH-2001', courseName: 'Differential Equations', semester: 'WInter'}, ]); db.students.insertMany([ { studentName: 'Alice', courseCode: 'ESOF-3050'}, { studentName: 'Bob', courseCode: 'ESOF-2570'}, { studentName: 'Cathy', courseCode: 'ESOF-3050'}, { studentName: 'David', courseCode: 'ESOF-4559'}, { studentName: 'Evan', courseCode: 'MATH-1001'}, { studentName: 'Frank', courseCode: 'MATH-2001'}, { studentName: 'Gary', courseCode: 'ESOF-4559'}, ]);
The exercises below are based on the collections IN THE ABOVE TEXT FILE
1. Update the item named journal to be named novel.
2. Update the dateOrdered field to be todays date for all items that were ordered before 2017-01-01.
3. Remove 5 from the quantity field for all orders.
4. Add 10 to the quantity field for all orders with a quantity greater than 40 but less than 90.
5. Remove the great review from the canvas item.
6. Add the reviews good and excellent to the sketch pad item. Note that your solution must include using the $each modifier.
7. Write a single equality join query to combine the students and courses collections.
8. Write a query that combines the profs and students collections. The resulting collection should display the professors name, the professors department name, the courses they are teaching, and a list of students enrolled in each course.
9. Write a correlated subquery that displays information about professors that are in the Software Engineering department. The resulting collection should display the professors name, the professors department name, and detailed information about the courses they are teaching (course code, course name, and semester).
10. Is hash-based sharding or range-based sharding more commonly used for partitioning large-scale database systems? Explain your reasoning.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started