MongooseIndex
@tsed/mongoose
Usage
typescript
import { MongooseIndex } from "@tsed/mongoose";
See /packages/orm/mongoose/src/types/decorators/mongooseIndex.ts.
Overview
ts
function MongooseIndex(fields: object, options?: any): Function;
Description
Calls schema.index() to define an index (most likely compound) for the schema.
Example
typescript
@Model()
@MongooseIndex({first: 1, second: 1}, {unique: 1})
export class EventModel {
@Property()
first: string;
@Property()
second: string;
}