Insert Operations

Last Updated :
Discuss
Comments

Question 1

What is the purpose of insert operations in MongoDB?

  • A

    Delete documents

  • B

    Update documents

  • C

    Add documents

  • D

    Retrieve documents

Question 2

Which method is used to insert a single document?

  • A

    insertMany()

  • B

    insertOne()

  • C

    addOne()

  • D

    createOne()

Question 3

Which method is used to insert multiple documents?

  • A

    insertAll()

  • B

    insertBulk()

  • C

    insertMany()

  • D

    insertMultiple()

Question 4

What does insertMany() return?

  • A

    Boolean value

  • B

    Number of documents

  • C

    Inserted document IDs

  • D

    Cursor

Question 5

What happens if you use insertOne() without specifying _id?

  • A

    Error occurs

  • B

    Document is rejected

  • C

    MongoDB automatically generates _id

  • D

    Document is ignored

Question 6

Which method was used earlier but is now deprecated in MongoDB?

  • A

    insert()

  • B

    insertOne()

  • C

    insertMany()

  • D

    add()

Question 7

What type of data does insertMany() accept?

  • A

    Single object

  • B

    Array of documents

  • C

    String

  • D

    Number

Question 8

Can insertOne() insert multiple documents?

  • A

    Yes

  • B

    No

  • C

    Sometimes

  • D

    Only in bulk mode

Question 9

What happens if one document fails in insertMany() (ordered=true)?

  • A

    All documents are inserted

  • B

    Operation stops at failure

  • C

    It retries automatically

  • D

    It ignores errors

Question 10

Which option improves performance for bulk inserts?

  • A

    insertOne()

  • B

    insertMany()

  • C

    find()

  • D

    updateOne()

There are 10 questions to complete.

Take a part in the ongoing discussion