Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / CRUD Operations with Node.js and MongoDB
mcq
Direction: Choose the correct option

Q1.

How do you insert a document using the Node.js driver?
A. collection.insertOne(doc)
B. collection.save(doc)
C. collection.add(doc)
D. db.insertOne(collection, doc)
Direction: Choose the correct option

Q2.

What does `collection.find({})` return in the Node.js driver?
A. An array of documents
B. The first document
C. A cursor object
D. A promise
Direction: Choose the correct option

Q3.

How do you update a document with the Node.js driver?
A. collection.modify(filter, update)
B. collection.change(filter, update)
C. collection.updateOne(filter, update)
D. collection.editOne(filter, update)
Direction: Choose the correct option

Q4.

What is the purpose of `result.deletedCount` after a delete operation?
A. The number of documents remaining
B. An error code
C. The number of documents deleted
D. The number of documents that matched the filter
Direction: Choose the correct option

Q5.

How do you convert a cursor returned by `find()` to an array of documents?
A. cursor.toArray()
B. cursor.getAll()
C. cursor.array()
D. cursor.fetch()