Imagine you have a huge library of books. Why is it important to ask specific questions (queries) to find the books you want?
Think about how you find a book in a big library without checking every shelf.
Queries let us ask for just the information we want, saving time and effort. Without queries, we would have to look through all data manually.
Given a collection students with documents containing {name, age, grade}, what will this query return?
{ age: { $gt: 18 } }db.students.find({ age: { $gt: 18 } })The operator $gt means 'greater than'.
The query finds all documents where the age field is greater than 18, so it returns students older than 18.
Which option shows a syntax error when trying to find documents where score is at least 70?
db.scores.find({ score: { $gte: 70 } })Check the operator names carefully.
The correct operator for 'greater than or equal' is $gte. Option C uses $greaterThanOrEqual, which is invalid syntax.
You want to find users aged exactly 30 in a large collection. Which query is better for performance?
Simple direct matches are usually faster than complex conditions.
Using { age: 30 } is the simplest and most direct way to match age 30. Other options add unnecessary complexity that can slow down the query.
Given a collection products with documents like {name: 'Pen', price: 1.5}, why does this query return an empty list?
db.products.find({ price: { $gt: '1' } })Think about data types and how MongoDB compares them.
MongoDB compares values by type. Comparing a number field to a string value causes no matches because types differ.