# Schema Decorator mongoose property class
Module | import { Schema } from "@tsed/mongoose" |
---|---|
Source | /packages/mongoose/src/decorators/schema.ts |
# Overview
function Schema(options?: MongooseSchemaOptions): (target: any) => void;
export function Schema(definition: SchemaTypeOpts<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.
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing