# Unique Decorator

Module
import { Unique } from "@tsed/mongoose"
Source/packages/mongoose/src/decorators/unique.ts

# Overview

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

# Description

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

# Example

@Model()
export class EventModel {
  @Unique()
  index: string;
}
1
2
3
4
5