Function index

  • Defines a index for this Class which will then be added to the Schema.

    Parameters

    • fields: IndexDefinition

      Which fields to index (if multiple fields are set, it will be a compound index)

    • Optional options: mongoose.IndexOptions

      Options to pass to MongoDB driver's createIndex() function

      Optional

    Returns ClassDecorator

    Example

    Example:

    @index({ article: 1, user: 1 }, { unique: true })
    class ClassName {}

Generated using TypeDoc