Complete the code to find all documents in the collection.
db.collection.[1]()insert() instead of find().update() or delete() which modify data.The find() method retrieves documents from a MongoDB collection.
Complete the code to find documents where the field 'age' is 25.
db.collection.find([1]: 25})
find().To filter documents by age, use {age: 25} inside find().
Fix the error in the code to find documents with 'status' equal to 'active'.
db.collection.find({status: [1])String values in MongoDB queries must be quoted with double or single quotes. Here, double quotes are correct.
Fill both blanks to find documents where 'score' is greater than 80.
db.collection.find({score: { [1]: [2] }})$lt which means 'less than'.The operator $gt means 'greater than'. So {score: {$gt: 80}} finds scores above 80.
Fill all three blanks to find documents where 'age' is less than 30 and only show the 'name' field.
db.collection.find([1]: { [2]: [3] }}, {name: 1})
$gt.Use {age: {$lt: 30}} to find ages less than 30. The second argument {name: 1} shows only the 'name' field.