C100DBA · Question #28
Which operations add new documents to a collection?
Insert (C) is the operation that adds new documents to a collection. The insert command (and its variants like insertOne and insertMany in MongoDB) creates and stores one or more new documents in a collection. Why the others are wrong: Update (B) modifies existing documents alrea
Question
Which operations add new documents to a collection?
Options
- Bupdate
- Cinsert
- Ddelete
Explanation
Insert (C) is the operation that adds new documents to a collection. The insert command (and its variants like insertOne and insertMany in MongoDB) creates and stores one or more new documents in a collection.
Why the others are wrong:
- Update (B) modifies existing documents already in the collection - it changes field values but does not create a new document unless used with an "upsert" option.
- Delete (D) removes existing documents from a collection - the opposite of adding.
Memory tip: Think of the word "insert" literally - you are inserting a brand-new document into the collection, like inserting a new row into a table. If it doesn't exist yet, only insert puts it there from scratch.
Topics
Community Discussion
No community discussion yet for this question.