Immutable
@tsed/mongoose
Usage
typescript
import { Immutable } from "@tsed/mongoose";
See /packages/orm/mongoose/src/types/decorators/immutable.ts.
Overview
ts
function Immutable(immutable?: boolean | ((this: any, doc: any) => boolean)): PropertyDecorator;
Description
If truthy, Mongoose will disallow changes to this path once the document is saved to the database for the first time. Read more about immutability in Mongoose here.
Example
typescript
@Model()
export class EventModel {
@Immutable()
field: string;
}