Page 1 of 1

b) Consider a sample BSON document given below. Assume that all documents in a collection empeProject has the same struc

Posted: Fri Jun 10, 2022 4:14 pm
by correctanswer
B Consider A Sample Bson Document Given Below Assume That All Documents In A Collection Empeproject Has The Same Struc 1
B Consider A Sample Bson Document Given Below Assume That All Documents In A Collection Empeproject Has The Same Struc 1 (90.63 KiB) Viewed 20 times
HI PLEASE HELP OUT WITH THIS QUESTION! URGENT THANK
YOU!
B Consider A Sample Bson Document Given Below Assume That All Documents In A Collection Empeproject Has The Same Struc 2
B Consider A Sample Bson Document Given Below Assume That All Documents In A Collection Empeproject Has The Same Struc 2 (80.44 KiB) Viewed 20 times
b) Consider a sample BSON document given below. Assume that all documents in a collection empeProject has the same structure as the document shown below: db.empeProject.insert ({ "_id":"empe001", "EMPLOYEE": {"empeId": "empe001", "fName":"James", "1Name": "Bond", "email": "[email protected]" "experience": ["Database Design", "SOL", "Java"], "Workon": {"EMPLOYEEPROJECT": [ {"projId":"proj001", "hoursWorked": 4), {"projId":"proj003", "hoursWorked": 5} ]} } }); db.empeProject.insert({ _id":"empe 002", "EMPLOYEE": {"empeId":"empe 002", "fName":"Harry", "1Name":"Potter", "experience": [ "Data Warehouse", "SOL", "Spark Scala", "Java Scripts"], "Workon": {"EMPLOYEEPROJECT": [ {"projId":"proj002", "hoursWorked": 6) ]} } }); "project Title": "Install MongoDB" }); db.empeProject.insert ({ "_id":"proj001", db.empeProject.insert({"_id":"proj002", db.empeProject.insert({ "_id":"proj003", "project Title": "Install Oracle" }); "project Title": "Install Spark" });

Use either a method find() or a method aggregate () available in MongoDB to write the implementations of the following queries. Implementation of each query is worth 1 mark. (i) Find the first name (fName) and last name (1Name) of all employee who have experience in Database Design. Do not show the object identifier (_id). (1.0 mark) (ii) Find the employee id (empeId) and hours worked in project (hoursWorked) of all employee who worked in project "proj003". (1.0 mark) (iii) Find all employees who possess 4 experiences. Show only the employee's information. (1.0 mark) Use the method update() to write the implementations of the following data manipulation operations. Implementation of each data manipulation operation is worth 1 mark. (iv) Add a new experience "HIVE" to the employee whose empeId is 'empe001'. (1.0 mark) (v) Change the email account for employee empe001 to "jamesbond$hotmail.com". (1.0 mark)