Concept Flow - How MongoDB indexes work (B-tree mental model)
Start: Query for value
Check root node keys
Compare query value with keys
Go to child node based on range
Repeat check keys in child node
Reach leaf node with pointers to documents
Return matching documents
End
The query starts at the root node of the B-tree, compares the value with keys to decide which child node to follow, repeats this until reaching a leaf node that points to matching documents.