How many documents are there with the value Tambra Mercure for the name field? How many documents
Question:
How many documents are there with the value Tambra Mercure for the name field?
How many documents were updated?
Run the following statement that will add an array for bonus quizzes to the student with
_id 5 / name Wilburn Spiess.
db.students.update(
{ _id: 5 },
{"$set" : {"bonus_quizzes" : [
{ "quiz": 1, "score" : 100 },
{ "quiz": 2, "score" : 80 },
{ "quiz": 3, "score" : 40 },
{ "quiz": 4, "score" : 70 }
]}}
)
need mongodb statement that will add the following five quizzes to the array bonus_quizzes to
the same student (i.e., Wilburn Spiess), sort all bonus quizzes and save only top 5
quizzes. Verify your statement.
i) "quiz": 5, "score" : 80
ii) "quiz": 6, "score" : 30
iii) "quiz": 7, "score" : 40
iv) "quiz": 8, "score" : 99
v) "quiz": 9, "score" : 85
How many update statements did we need to write?
How many documents each of the statements updated?
b. need mogodu statement to modify the value of the program field/key to "Math and
Computer Science" for the student named Tambra Mercure.
Before executing an update statement or a delete statement, you can use the find() method
with the update or delete criteria, to see how many documents will be affected.
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last