IndexParameter

public enum IndexParameter

The options to apply to the creation of an index.

  • one:
  • two:
  • sort:
  • sortedCompound:
  • compound:
  • expire:
  • sparse: the index only references documents with the specified field
  • custom:
  • partialFilter:
  • unique: the index should be unique
  • buildInBackground: Create the index in the background
  • weight: the weighting object for use with a text index
  • text:
  • A TextIndexVersion defines to MongoDB what kind of text index should be created. Generally this is .two

    See more

    Declaration

    Swift

    public enum TextIndexVersion: ValueConvertible
  • Applies Collation rules to String comparison

    Declaration

    Swift

    case collation(Collation)
  • Sorts the specified field with in the given order

    Declaration

    Swift

    case sort(field: String, order: SortOrder)
  • Sorts the specified fields in the given order. The first specified key is the first key that will be used for sorting.

    The second key will be used for sorting only when documents match equally with on first key

    Declaration

    Swift

    case sortedCompound(fields: [(field: String, order: SortOrder)])
  • Declaration

    Swift

    case compound(fields: [(field: String, value: BSON.Primitive)])
  • Removes a Document after it’s been in the database for the provided amount of seconds

    Declaration

    Swift

    case expire(afterSeconds: Int)
  • Only indexes a Document when the Document contain the indexed fields, even if it’s Null

    Declaration

    Swift

    case sparse
  • A custom index Document for unsupported features.

    Generally not useful. Make a Issue or PR for the implemented feature if you happen to need this

    Declaration

    Swift

    case custom(Document)
  • Partial indexes only index Documents matching certain requirements. Like a user whose age is at least 25 years old. This is done using a provided raw MongoDB Document containing operators

    Declaration

    Swift

    case partialFilter(Document)
  • Requires indexed fields to be unique

    Declaration

    Swift

    case unique
  • Builds this index in the background. Useful for applications that have a lot of data

    Declaration

    Swift

    case buildInBackground
  • Applies text indexing to the provided keys

    Declaration

    Swift

    case text([String])
  • A Geospatial index on a field

    Declaration

    Swift

    case geo2dsphere(field: String)