MongoDB Aggregation Q1 (6 marks).Populate a products collection… MongoDB Aggregation Q1 (6 marks). Populate a products collection using the following command (make sure that no documents exist in the products collection before running the command). db.products.insertMany( [ { item: “book”, size: { h: 28, w: 35 }, status: “A” , instock: [ { warehouse: “A”, qty: 35 }, { warehouse: “B”, qty: 30 }, { warehouse: “C”, qty: 20 } ] }, { item: “journal”, size: { h: 16, w: 25}, status: “A”, instock: [ { warehouse: “C”, qty: 15 } ] }, { item: “mat”, size: { h: 19, w: 23 }, status: “P”, instock: [ { warehouse: “A”, qty: 60 } ] }, { item: “notebook”, size: { h: 8.5, w: 11 }, status: “A”, instock: [ { warehouse: “A”, qty: 40 }, { warehouse: “B”, qty: 5 } ] }, { item: “postcard”, size: { h: 8.5, w: 11 }, status: “P”, instock: [ { warehouse: “A”, qty: 20 }, { warehouse: “B”, qty: 15 }, { warehouse: “C”, qty: 35 }, { warehouse: “D”, qty: 15 } ] }, { item: “sketchbook”, size: { h: 18.85, w: 30 }, status: “P”, instock: [ { warehouse: “A”, qty: 25 }, { warehouse: “C”, qty: 25 }, { warehouse: “D”, qty: 20 } ] }] ); Find the documents in which the instock array has more than two elements and the qty of the first element is less than 30. Display the item and status fields only in the result. Copy and paste your MongoDB command below Insert the screenshot of result below 2.Find the documents in which h is greater than 20 or the qty at warehouse C is greater than 30. Display the item and size fields only in the result (you should not use $unwind). Copy and paste your MongoDB command below Insert the screenshot of result below Q2 (6 marks). Populate an instructors collection using the following command (make sure that no documents exist in the instructors collection before running the command). db.instructors.insertMany( [ { “name”: “Zhang”, “dept_name”: “CS”, “salary”: 68000, “teaches”: [ { course_id: “CS-101”, year: 2018 }, { course_id: “CS-347”, year: 2018 } ] }, { “name”: “Levy”, “dept_name”: “CS”, “salary”: 80000, “teaches”: [ { course_id: “CS-128”, year: 2016 }, { course_id: “CS-201”, year: 2017 } ] }, { “name”: “Brandt”, “dept_name”: “Finance”, “salary”: 90000, “teaches”: [ { course_id: “FIN-201”, year: 2016 }, { course_id: “FIN-301”, year: 2017 }, { course_id: “FIN-320”, year: 2017 } ] }, { “name”: “Davis”, “dept_name”: “Finance”, “salary”: 78000, “teaches”: [ { course_id: “FIN-102”, year: 2017 }, { course_id: “FIN-200”, year: 2018 } ] }, { “name”: “Crick”, “dept_name”: “Biology”, “salary”: 92000, “teaches”: [ { course_id: “BIO-101”, year: 2017 }, { course_id: “BIO-301”, year: 2018 }, { course_id: “BIO-301”, year: 2018 } ] }, { “name”: “Williams”, “dept_name”: “Biology”, “salary”: 72000, “teaches”: [ { course_id: “BIO-101”, year: 2016 }, { course_id: “BIO-201”, year: 2017 }, { course_id: “BIO-101”, year: 2018 } ] }] ); Find the average salary of each department and sort the result by the average salary in descending order. The result should display the department name and the average salary of each department. Copy and paste your MongoDB command below Insert the screenshot of result below 2.Find the number of instructors who taught in each year and sort the result in chronological order. The sample output is as follows. You may check the $addToSet operator. Copy and paste your MongoDB command below Insert the screenshot of result below Q3 (6 marks). Populate a clothes collection using the following command (make sure that no documents exist in the clothes collection before running the command). db.clothes.insertMany( [ { product: “blouse”, instock: [ { size: “M”, qty: 35 }, { size: “S”, qty: 35 } ], type: “women” }, { product: “hoodie”, instock: [{ size: “S”, qty: 35 } ], type: “boys” }, { product: “jacket”, instock: [ { size: “M”, qty: 40 }, { size: “S”, qty: 25 } ], type: “girls” }, { product: “jeans”, instock: [ { size: “L”, qty: 50 }, { size: “M”, qty: 20 } ], type: “men” }, { product: “pant”, instock: [{ size: “L”, qty: 40 } ], type: “men” }, { product: “shirt”, instock: [ { size: “M”, qty: 15 }, { size: “S”, qty: 10 } ], type: “women” } ] ); Find the total qty of each size. Display the size and total qty of the size only if the total qty is greater than 100. Copy and paste your MongoDB command below Insert the screenshot of result below 2.Find the product(s) of each “type” and store them/it in a products array for each type. Display the “type” and “products” only if the products array contains exactly two elements. The result may look like the following (pay attention to the field name).Image transcription text“type”women”prod… Show more… Show more Copy and paste your MongoDB command below Insert the screenshot of result belowEngineering & Technology Computer Science CSIS 3300
You will get a plagiarism-free paper and you can get an originality report upon request.
All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more