SortOrder

public enum SortOrder: ValueConvertible

Defines the order in which a field has to be sorted

  • Ascending means that we order from past to future or from 0 to 10

    Declaration

    Swift

    case ascending
  • Descending is opposite of ascending

    Declaration

    Swift

    case descending
  • Custom can be useful for more complex MongoDB behaviour. Generally not used.

    Declaration

    Swift

    case custom(BSON.Primitive)
  • Converts the SortOrder to a BSON primitive for easy embedding

    Declaration

    Swift

    public func makePrimitive() -> BSON.Primitive