# MongooseIndex Decorator mongoose class
Module | import { MongooseIndex } from "@tsed/mongoose" |
---|---|
Source | /packages/mongoose/src/decorators/mongooseIndex.ts |
# Overview
function MongooseIndex(fields: object, options?: any): Function;
# Description
Calls schema.index() to define an index (most likely compound) for the schema.
# Example
@Model()
@MongooseIndex({first: 1, second: 1}, {unique: 1})
export class EventModel {
@Property()
first: string;
@Property()
second: string;
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
- 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