Description
This package contains some tools to make querying with pagination easier using MongoDB with Mongoose and Nest.js.
Decorators
-
MongoQuery: This Param Decorator accepts some parameters for a Get request such as search fields, sorting and pagination. These are it's parameters:
- filterProps: The list of properties that should be searchable and filterable
- searchProps: The props for partial search
- ApiMongoQuery: This decorator adds definitions to the Swagger documentation
## Example:
@ApiMongoQuery({ filterProps: ['dateCreated', 'name'] })
@Get()
getChannels(
@MongoQuery({
filterProps: ['dateCreated', 'name'],
searchProps: ['search'],
})
mongoQuery: IMongoQuery,
) {
return this._channelService.handleGetChannels(user.id, mongoQuery);
}