@skyroom/mongo-query
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

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);
}

Readme

Keywords

none

Package Sidebar

Install

npm i @skyroom/mongo-query

Weekly Downloads

1

Version

1.1.2

License

MIT

Unpacked Size

23.8 kB

Total Files

52

Last publish

Collaborators

  • mkhahani
  • rostamiani