→ The index stores {1, 2} regardless of array order.
Since $sortArray only changes the order of elements, not the set of values, the index entries don’t change.➝ MongoDB does not need to update/reindex in this case. The index is valid.
Again, sorting doesn’t change the pairs, so the index entries remain the same.➝ No reindexing needed.
Only if you change, add, or remove array elements (e.g., modify a priority or dueDate value, push/pop a task). Pure reordering isn’t considered a modification that affects the index.
We are sure that the index will be the same after sorting the array, but the key question is whether Mongo can anticipate this and therefore save the reindexing process, or whether it will carry out the reindexing of the index even though the result will be the same. Is there any place in the Mongo documentation that supports your claim?