Update Operations

Last Updated :
Discuss
Comments

Question 1

What is the purpose of update operations in MongoDB?

  • Insert documents

  • Retrieve documents

  • Modify existing documents

  • Delete documents

Question 2

Which method updates only one matching document?

  • updateAll()

  • updateOne()

  • updateMany()

  • replaceMany()

Question 3

Which method updates multiple documents?

  • updateOne()

  • updateAll()

  • updateMany()

  • replaceOne()

Question 4

What does replaceOne() do?

  • Deletes a document

  • Updates specific fields

  • Replaces entire document

  • Adds new document

Question 5

Which operator is commonly used with update operations?

  • $set

  • $find

  • $insert

  • $delete

Question 6

What happens if no document matches updateOne()?

  • Error occurs

  • Nothing is updated

  • Document is deleted

  • Database crashes

Question 7

Which method should be used to update all matching records?

  • updateOne()

  • replaceOne()

  • updateMany()

  • insertMany()

Question 8

What happens if you use updateOne() without $set?

  • Only specific fields update

  • Entire document is replaced

  • Error occurs

  • Nothing happens

Question 9

Which method is best for changing only one field in multiple documents?

  • updateMany()

  • replaceOne()

  • insertMany()

  • findOne()

Question 10

Which method ensures only one document is fully replaced?

  • updateMany()

  • updateOne()

  • replaceOne()

  • insertOne()

There are 10 questions to complete.

Take a part in the ongoing discussion