As part of SERVER-35693, parsing a $in query will always sort the array argument before constructing a boost::flat_set. This greatly benefits the case where the number of elements is very large (>10k) and is unsorted, however as a side effect it hurts performance when the array is already sorted.
One option would be to add an optimization for the sorted case by checking std::is_sorted before sorting the array.