explain()
noun
say it: “ik-SPLAYN” /ɪkˈspleɪn/
A MongoDB method that reports how a query ran, such as whether it used an index and how many documents it read.
What does explain() do?
explain() shows how MongoDB ran a query: which index it used and how many documents it examined, so you can spot missing indexes.
db.recipes.find({ category: 'Dessert' }).explain('executionStats')
In a sentence
- “Running explain() with "executionStats" counts the documents examined.”
- “explain() showed COLLSCAN, so the query had no index to use.”
Level: Freelancer · More MongoDB terms at this level
Updated