UNPKG

1.86 kBTypeScriptView Raw
1/// <reference types="mongoose/types/aggregate" />
2/// <reference types="mongoose/types/callback" />
3/// <reference types="mongoose/types/collection" />
4/// <reference types="mongoose/types/connection" />
5/// <reference types="mongoose/types/cursor" />
6/// <reference types="mongoose/types/document" />
7/// <reference types="mongoose/types/error" />
8/// <reference types="mongoose/types/expressions" />
9/// <reference types="mongoose/types/helpers" />
10/// <reference types="mongoose/types/middlewares" />
11/// <reference types="mongoose/types/indexes" />
12/// <reference types="mongoose/types/models" />
13/// <reference types="mongoose/types/mongooseoptions" />
14/// <reference types="mongoose/types/pipelinestage" />
15/// <reference types="mongoose/types/populate" />
16/// <reference types="mongoose/types/query" />
17/// <reference types="mongoose/types/schemaoptions" />
18/// <reference types="mongoose/types/schematypes" />
19/// <reference types="mongoose/types/session" />
20/// <reference types="mongoose/types/types" />
21/// <reference types="mongoose/types/utility" />
22/// <reference types="mongoose/types/validation" />
23/// <reference types="mongoose/types/virtuals" />
24/// <reference types="mongoose/types/inferschematype" />
25/// <reference types="mongoose/types/inferrawdoctype" />
26import mongoose from 'mongoose';
27import type { IndexOptions } from './types';
28/**
29 * Defines a index for this Class which will then be added to the Schema.
30 * @param fields Which fields to index (if multiple fields are set, it will be a compound index)
31 * @param options Options to pass to MongoDB driver's createIndex() function
32 * @example Example:
33 * ```ts
34 * @index({ article: 1, user: 1 }, { unique: true })
35 * class ClassName {}
36 * ```
37 */
38export declare function index(fields: mongoose.IndexDefinition, options?: IndexOptions): ClassDecorator;
39export { index as Index };