UNPKG

578 BTypeScriptView Raw
1import mongoose from 'mongoose';
2import type { IndexOptions } from './types';
3/**
4 * Defines a index for this Class which will then be added to the Schema.
5 * @param fields Which fields to index (if multiple fields are set, it will be a compound index)
6 * @param options Options to pass to MongoDB driver's createIndex() function
7 * @example Example:
8 * ```ts
9 * @index({ article: 1, user: 1 }, { unique: true })
10 * class ClassName {}
11 * ```
12 */
13export declare function index(fields: mongoose.IndexDefinition, options?: IndexOptions): ClassDecorator;
14export { index as Index };