# Decorator Schema
Decorator mongoose property classModule | import { Schema } from "@tsed/mongoose" |
---|---|
Source | /packages/orm/mongoose/src/types/decorators/schema.ts |
# Overview
function Schema(options?: MongooseSchemaOptions): (target: any) => void;
export function Schema(definition: SchemaTypeOptions<any>): Function;
# Description
Define a class as a Mongoose Schema ready to be used to compose other schemes and models.
# Example
@MongooseSchema()
export class EventSchema {
@Property()
field: string;
}
1
2
3
4
5
2
3
4
5
# Options
schemaOptions
(mongoose.SchemaOptions): Option to configure the schema behavior.