aravindnc / mongoose-aggregate-paginate-v2

A cursor based custom aggregate pagination library for Mongoose with customizable labels.
MIT License
131 stars 23 forks source link

[Feature Request] Too much information in return data #22

Closed denmasyarikin closed 3 years ago

denmasyarikin commented 4 years ago

i like customLabels option it usefull for me, but it will be better if visibility of fields can also customized via options.

Suggestion

const options = {
        limit: 10,
        page: 1,
        customLabels: {
          totalDocs: 'total',
          docs: 'data',
          limit: 'limit',
          page: 'page',
          totalPages: 'pages',
          nextPage: false,
          prevPage: false,
          hasPrevPage: false,
          hasNextPage: false,
          pagingCounter: false
        }
      }

so if value has a falsy, it will removed from the object.

aravindnc commented 3 years ago

@denmasyarikin Added customLabels.meta to handle this. use latest version 1.0.5.