def order_by(*spec)
      option(spec) do |options, query|
        spec.compact.each do |criterion|
          criterion.__sort_option__.each_pair do |field, direction|
            add_sort_option(options, field, direction)
          end
          query.pipeline.push("$sort" => options[:sort]) if aggregating?
        end
      end
    end
def order_by(*spec)
      option(spec) do |options, query|
        spec.compact.each do |criterion|
          criterion.__sort_option__.each_pair do |field, direction|
            add_sort_option(options, field, direction)
          end
          query.pipeline.push("$sort" => options[:sort]) if aggregating?
        end
      end
    end
Adds sorting criterion to the options.

 @example Add sorting options via a hash with integer directions.
   optional.order_by(name: 1, dob: -1)

 @example Add sorting options via a hash with symbol directions.
   optional.order_by(name: :asc, dob: :desc)

 @example Add sorting options via a hash with string directions.
   optional.order_by(name: "asc", dob: "desc")

 @example Add sorting options via an array with integer directions.
   optional.order_by([[ name, 1 ], [ dob, -1 ]])

 @example Add sorting options via an array with symbol directions.
   optional.order_by([[ name, :asc ], [ dob, :desc ]])

 @example Add sorting options via an array with string directions.
   optional.order_by([[ name, "asc" ], [ dob, "desc" ]])

 @example Add sorting options with keys.
   optional.order_by(:name.asc, :dob.desc)

 @example Add sorting options via a string.
   optional.order_by("name ASC, dob DESC")

 @param [ Array, Hash, String ] spec The sorting specification.

 @return [ Optional ] The cloned optional.

 @since 1.0.0