Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use find command to search results. Find documents where quantity qty greater than 50. Provide command and screen shot of results of execution of your

Use find command to search results. Find documents where quantity qty greater than 50. 

Provide command and screen shot of results of execution of your command. 

a)Use find command to search documents where quantity  (qty) in between 46 and 65.   

(>=46 and <=65) 

Provide command and screen shot of results of execution of your command

 

2.a) Construct the MongoDB Shell code to remove all inventory, from the collection, whose 'qty' is greater than 70.   

Provide command and screen shot of results of execution of your command. 

  1. Use deleteMany function to delete all "D" status documents. Status must be D to delete. 

Provide command and screen shot of results of execution of your command. 

 

3.The students are about to construct an assignment. Each student will be assigned to a team. Students with 

i) _id 1 to 6 will be in team 1  
ii)  _id 7 to 12 will be in team 2 

iii)  _id 13 to 18 will be in team 3 

   

a)Construct update statements to add field/key team and set it to a value based on their _id. Verify your updates. 

Provide command and screen shot of results of execution of your command

 

b)The students completed assignments. The professor marked assignments and gave scores to each team. 

i)     team 1 received score 90.00  
ii)     team 2 received score 87.00
iii)     team 3 received score 94.00 

Make update statements to add a new element to the array scores to reflect a score for this assignment. The new element should have a similar format to the scores for exam, quiz, and homework. The value of the score will be the same for all students in the same team for the assignment. Verify your updates. Make sure that every student receives mark for their assignments. 

Provide command and screen shot of results of execution of your command. 

 

4.Run the following statement that will add an array for bonus quizzes to the student with _id 12, name Quincy Danaher.
 

db.students.updateOne( 

  { _id: 12}, 

 {"$set" : {"bonus_quizzes" : [ 

         { "quiz": 1, "score" : 95}, 

         { "quiz": 2, "score" : 80 }, 

         { "quiz": 3, "score" : 40 }, 

         { "quiz": 4, "score" : 70 } 

      ]}} 

Construct a statement that will add the following five quizzes to the array bonus_quizzes to the same student (i.e., Quincy Danaher), sort all bonus quizzes and save only top 4 quizzes. Verify your statement. 

                 

i) "quiz": 5, "score" : 90  
ii) "quiz": 6, "score" : 35
iii) "quiz": 7, "score" : 45
iv) "quiz": 8, "score" : 98
v) "quiz": 9, "score" : 83 

 

Provide command and screen shot of results of execution of your command

 

5.Use aggregate function to calculate total, average, minimum, and maximum salary for each department. Use collection employees and its documents. 

 

Provide command and screen shot of results of execution of your command. 

 

6.Create a collection songs. Insert one document with two key value pairs. The first key should be song type, the value opera. The second key should be songs with the value an array with the following opera songs: 

"O mio babbino caro" 

"Largo al factotum" 

"Habanera" 

"Nessun dorma" 

"Queen of the Night" 

 

The array must NOT contain duplicates!!! 

 

a)Provide command and screen shot of results of execution of your command. 

 

 

b)Construct a command to add the following opera in the array assigned to the key songs: 

 

"Nessun dorma" 

 

Display final result in collection songs. 

 

Provide command and screen shot of results of execution of your command

 

 

c)Construct a command to add the following opera in the array assigned to the key songs: 

 

"Song to the Moon" 

 

Display final result in collection songs. 

 

Provide command and screen shot of results of execution of your command. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing Cases An Interactive Learning Approach

Authors: Mark S Beasley, Frank A. Buckless, Steven M. Glover, Douglas F Prawitt

7th Edition

0134421825, 9780134421827

More Books

Students also viewed these Databases questions