OrderBy

Orders the input documents based on the specified key function.
The ordered documents are output as the result of this module.

Usage

  • OrderBy(DocumentConfig key)

    Orders the input documents using the specified delegate to get the ordering key.

    • key

      A delegate that should return the key to use for ordering.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • Descending(bool descending = true)

    Specifies whether the documents should be output in descending order (the default is ascending order). If you use this method after called ThenBy, the descending ordering will apply to the secondary sort.

    • descending

      If set to true, the documents are output in descending order.

  • ThenBy(DocumentConfig key)

    Orders the input documents using the specified delegate to get a secondary ordering key. You can chain as many ThenBy calls together as needed.

    • key

      A delegate that should return the key to use for ordering.

  • WithComparer(IComparer<Object> comparer)

    Specifies a comparer to use for the ordering.

    • comparer

      The comparer to use.

  • WithComparer<TValue>(IComparer<TValue> comparer)

    Specifies a typed comparer to use for the ordering. A conversion to the comparer type will be attempted for all metadata values. If the conversion fails, the values will be considered equivalent. Note that this will also have the effect of treating different convertible types as being of the same type. For example, if you have two keys, 1 and "1", and use a string-based comparison, the documents will compare as equal.

    • comparer

      The typed comparer to use.

GitHub