Skip to main content

Interface: IndexOptions

Defined in: service-core/src/decorators/PersistenceDecorators.ts:58

The set of options available when declaring a database index via the @Index decorator.

Properties

background?

optional background?: boolean

Defined in: service-core/src/decorators/PersistenceDecorators.ts:64

Set to true to build the index in the background. (MongoDB only)


collation?

optional collation?: CollationOptions

Defined in: service-core/src/decorators/PersistenceDecorators.ts:68

The language-specific collation rules to apply to the index. (MongoDB only)


expireAfterSeconds?

optional expireAfterSeconds?: number

Defined in: service-core/src/decorators/PersistenceDecorators.ts:66

The time, in seconds, after which indexed documents will be automatically deleted. (MongoDB only)


sparse?

optional sparse?: boolean

Defined in: service-core/src/decorators/PersistenceDecorators.ts:62

Set to true to only index documents in which the indexed properties exist. (MongoDB only)


unique?

optional unique?: boolean

Defined in: service-core/src/decorators/PersistenceDecorators.ts:60

Set to true to enforce that all values of the indexed properties are unique.