Complete the code to find one document in the 'users' collection.
db.users.[1]({})find instead of findOne returns a cursor, not a single document.The findOne method returns a single document from the collection that matches the query.
Complete the code to find one user with the name 'Alice'.
db.users.findOne({ name: [1] })The query object specifies name: 'Alice' to find a user named Alice.
Fix the error in the code to find one document where age is 30.
db.users.findOne({ age: [1] })The age value should be a number, not a string, so use 30 without quotes.
Fill both blanks to find one document where status is 'active' and return only the name field.
db.users.findOne({ status: [1] }, { [2]: 1 })The query filters for status: 'active' and the projection returns only the name field.
Fill all three blanks to find one document where age is greater than 25 and return only the name and age fields.
db.users.findOne({ age: { [1]: [2] } }, { [3]: 1, age: 1 })The query uses $gt: 25 to find ages greater than 25, and the projection includes name and age fields.