Interface IndexOptions

interface IndexOptions {
    2dsphereIndexVersion?: number;
    bits?: number;
    bucketSize?: number;
    collation?: CollationOptions;
    defaultLanguage?: string;
    expireAfterSeconds?: number;
    hidden?: boolean;
    languageOverride?: string;
    max?: number;
    min?: number;
    name?: string;
    partialFilterExpression?: Document;
    sparse?: boolean;
    storageEngine?: Document;
    textIndexVersion?: number;
    unique?: boolean;
    version?: number;
    weights?: Document;
    wildcardProjection?: Document;
}

Hierarchy (view full)

Properties

2dsphereIndexVersion?: number

Optionally specifies the 2dsphere index version number.

bits?: number

Optionally specifies the precision of the stored geo hash in the 2d index, from 1 to 32.

bucketSize?: number

Optionally specifies the number of units within which to group the location values in a geo haystack index.

collation?: CollationOptions

Optionally specifies a collation to use for the index. If not specified, no collation is sent and the default collation of the collection server-side is used.

defaultLanguage?: string

Optionally specifies the default language for text indexes. Is 'english' if none is provided.

expireAfterSeconds?: number

Optionally specifies the length in time, in seconds, for documents to remain in a collection.

hidden?: boolean

Optionally specifies that the index should exist on the target collection but should not be used by the query planner when executing operations.

This option is only supported by servers >= 4.4.

languageOverride?: string

Optionally Specifies the field in the document to override the language.

max?: number

Optionally sets the maximum boundary for latitude and longitude in the 2d index.

min?: number

Optionally sets the minimum boundary for latitude and longitude in the index in a 2d index.

name?: string

Optionally specify a specific name for the index outside of the default generated name. If none is provided then the name is generated in the format "[field]_[direction]".

Note that if an index is created for the same key pattern with different collations, a name must be provided by the user to avoid ambiguity.

For an index of name: 1, age: -1, the generated name would be "name_1_age_-1".
partialFilterExpression?: Document

Optionally specifies a filter for use in a partial index. Only documents that match the filter expression are included in the index.

sparse?: boolean

Optionally tells the index to only reference documents with the specified field in the index.

storageEngine?: Document

Optionally allows users to configure the storage engine on a per-index basis when creating an index.

textIndexVersion?: number

Optionally provides the text index version number.

unique?: boolean

Optionally forces the index to be unique.

version?: number

Optionally specifies the index version number, either 0 or 1.

weights?: Document

Optionally specifies fields in the index and their corresponding weight values.

wildcardProjection?: Document

Optionally specifies the wildcard projection of a wildcard index.