Skip to content

Schema

@tsed/mongoose

Usage ​

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

See /packages/orm/mongoose/src/decorators/schema.ts.

Overview ​

ts
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 ​

typescript
@MongooseSchema()
export class EventSchema {
  @Property()
  field: string;
}

Options ​

  • schemaOptions (mongoose.SchemaOptions): Option to configure the schema behavior.

Released under the MIT License.