Skip to content

Unique

@tsed/mongoose

Usage

typescript
import { Unique } from "@tsed/mongoose";

See /packages/orm/mongoose/src/types/decorators/unique.ts.

Overview

ts
function Unique(unique?: boolean | any): Function;

Description

Tell Mongoose to ensure a unique index is created for this path.

Example

typescript
@Model()
export class EventModel {
  @Unique()
  index: string;
}

Released under the MIT License.