Concept Flow - Index direction (ascending vs descending)
Create Index
Specify Field and Direction
Ascending (1) or Descending (-1)?
Ascending: Sorts from smallest to largest
Descending: Sorts from largest to smallest
Index Built with Direction
Query Uses Index for Sorting
When creating an index in MongoDB, you specify the field and direction (1 for ascending, -1 for descending). This direction controls how the index sorts the data, which affects query performance when sorting.