Class DbIndex

Creates a new index instance which is needed to create an database index.

Hierarchy

  • DbIndex

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • keys: string | IndexSpec | {
          [name: string]: string;
      }

      The name of the field which will be used for the index, an object of an field and index type combination or an array of objects to create an compound index

    • Optional unique: boolean

      Indicates if the index will be unique

    Returns DbIndex

Properties

keys: IndexSpec

An array of mappings from field to index type which are parts of this index/compound index

unique: boolean
ASC: "asc" = 'asc'
DESC: "desc" = 'desc'
GEO: "geo"

Accessors

  • get isCompound(): boolean
  • Indicates if this index is a compound index of multiple attributes

    Returns boolean

  • get isUnique(): boolean
  • Indicates if this index is an unique index

    Returns boolean

Methods

  • Indicates if this index is for the given field or includes it in a compound index

    Returns

    true if the index contains this field

    Parameters

    • name: string

      The name of the field to check for

    Returns boolean

  • Returns a JSON representation of the Index object

    Returns

    A Json of this Index object

    Returns JsonMap

  • Returns DbIndex Object created from the given JSON

    Returns

    Parameters

    Returns DbIndex

Generated using TypeDoc