Complete the code to analyze a MongoDB query using the explain method.
db.collection.find({ name: 'Alice' }).[1]()The explain() method shows how MongoDB runs a query, helping you understand its performance.
Complete the code to get the execution stats of a query using explain.
db.collection.find({ age: { $gt: 25 } }).explain('[1]')The executionStats verbosity level provides detailed information about the query execution.
Fix the error in the code to correctly use explain with verbosity.
db.collection.find().explain([1])The verbosity argument must be a string inside quotes, like 'executionStats'.
Fill both blanks to explain a query with 'allPlansExecution' verbosity and filter by status 'active'.
db.users.find({ status: '[1]' }).explain('[2]')Use 'active' to filter users and 'allPlansExecution' to get detailed plan info.
Fill all three blanks to explain a query on 'products' collection filtering price > 100 with 'queryPlanner' verbosity.
db.[1].find({ price: { $[2]: 100 } }).explain('[3]')
The collection is products, the operator is gt for greater than, and verbosity queryPlanner shows the plan.