Loading

Quipoin Menu

Learn • Practice • Grow

node-js / CRUD Operations with MongoDB
mcq
Direction: Choose the correct option

Q1.

In MongoDB, which method inserts a single document?
A. insert()
B. create()
C. insertOne()
D. add()
Direction: Choose the correct option

Q2.

How do you find all documents in a collection using the MongoDB driver?
A. collection.findAll()
B. collection.find({}).toArray()
C. collection.getAll()
D. collection.find({})
Direction: Choose the correct option

Q3.

Which method updates a single document in MongoDB?
A. updateOne()
B. updateMany()
C. modify()
D. update()
Direction: Choose the correct option

Q4.

How do you delete a document by ID in Mongoose?
A. Model.findByIdAndDelete(id)
B. Model.deleteOne({_id: id})
C. Model.remove({_id: id})
D. All of the above
Direction: Choose the correct option

Q5.

What does `Model.find({ age: { $gt: 18 } })` do?
A. Finds documents where age is less than 18
B. Finds all documents
C. Finds documents with age exactly 18
D. Finds documents where age is greater than 18