Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Read Operations Basics
mcq
Direction: Choose the correct option

Q1.

Which method is used to query documents in a collection?
A. db.collection.search()
B. db.collection.find()
C. db.collection.get()
D. db.collection.query()
Direction: Choose the correct option

Q2.

What does `db.users.findOne({name: 'Alice'})` return?
A. The count of matching documents
B. An array of all users named Alice
C. The first matching document
D. A cursor to the results
Direction: Choose the correct option

Q3.

What is returned by `db.users.find({age: 25})`?
A. A document
B. A cursor to the matching documents
C. The first document
D. An array
Direction: Choose the correct option

Q4.

How do you retrieve all documents from a collection?
A. db.collection.findAll()
B. db.collection.all()
C. db.collection.find('*')
D. db.collection.find({})
Direction: Choose the correct option

Q5.

What does the `pretty()` method do in the MongoDB shell?
A. Adds colors to the output
B. Formats the output for readability
C. Limits the results
D. Sorts the results