API 参考
    正在准备搜索索引...
    interface IndexDescription {
        "2dsphereIndexVersion"?: number;
        background?: boolean;
        bits?: number;
        bucketSize?: number;
        collation?: CollationOptions;
        default_language?: string;
        expireAfterSeconds?: number;
        hidden?: boolean;
        key: { [key: string]: IndexDirection } | Map<string, IndexDirection>;
        language_override?: string;
        max?: number;
        min?: number;
        name?: string;
        partialFilterExpression?: Document;
        sparse?: boolean;
        storageEngine?: Document;
        textIndexVersion?: number;
        unique?: boolean;
        version?: number;
        weights?: Document;
        wildcardProjection?: Document;
    }

    层级

    • Pick<
          CreateIndexesOptions,
          | "background"
          | "unique"
          | "partialFilterExpression"
          | "sparse"
          | "hidden"
          | "expireAfterSeconds"
          | "storageEngine"
          | "version"
          | "weights"
          | "default_language"
          | "language_override"
          | "textIndexVersion"
          | "2dsphereIndexVersion"
          | "bits"
          | "min"
          | "max"
          | "bucketSize"
          | "wildcardProjection",
      >
      • IndexDescription
    索引

    属性

    "2dsphereIndexVersion"?: number
    background?: boolean

    Creates the index in the background, yielding whenever possible.

    bits?: number
    bucketSize?: number
    collation?: CollationOptions
    default_language?: string
    expireAfterSeconds?: number

    Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)

    hidden?: boolean

    Specifies that the index should exist on the target collection but should not be used by the query planner when executing operations. (MongoDB 4.4 or higher)

    key: { [key: string]: IndexDirection } | Map<string, IndexDirection>
    language_override?: string
    max?: number

    For geospatial indexes set the high bound for the co-ordinates.

    min?: number

    For geospatial indexes set the lower bound for the co-ordinates.

    name?: string
    partialFilterExpression?: Document

    Creates a partial index based on the given filter object (MongoDB 3.2 or higher)

    sparse?: boolean

    Creates a sparse index.

    storageEngine?: Document

    Allows users to configure the storage engine on a per-index basis when creating an index. (MongoDB 3.0 or higher)

    textIndexVersion?: number
    unique?: boolean

    Creates an unique index.

    version?: number

    Specifies the index version number, either 0 or 1.

    weights?: Document
    wildcardProjection?: Document