# ObjectID Decorator mongoose schema
Module | import { ObjectID } from "@tsed/mongoose" |
---|---|
Source | /packages/mongoose/src/decorators/objectID.ts |
# Overview
function ObjectID(name?: string): any;
export type ObjectID = Types.ObjectId;
# Description
Tell Mongoose whether to define an ObjectId property.
# Example
@Model()
export class EventModel {
@ObjectId('id')
_id: string;
}
1
2
3
4
5
2
3
4
5
- 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