Encode sort specs in finds and updates.