Question
Single-field versus compound indexes: what differs, and when should each be used?
Answer
A single-field index orders one field; a compound index orders multiple fields in declared order. Use single-field indexes for independent predicates; use compound indexes for recurring combined filters, sorts, or prefix queries. Applies to self-managed MongoDB and Atlas.