Skip to content

disablePagination

hooks
Source Code | Documentation

Disables pagination when query.$limit is -1 or '-1'. Removes the $limit from the query and sets params.paginate = false. Must be used as a before or around hook on the find method.

ts
  import { 
disablePagination
} from 'feathers-utils/hooks';

Example

ts
import { disablePagination } from 'feathers-utils/hooks'

app.service('users').hooks({
  before: { find: [disablePagination()] }
})
// Then call: app.service('users').find({ query: { $limit: -1 } })

Type declaration

Show Type Declarations
ts
/**
 * Disables pagination when `query.$limit` is `-1` or `'-1'`.
 * Removes the `$limit` from the query and sets `params.paginate = false`.
 * Must be used as a `before` or `around` hook on the `find` method.
 *
 * @example
 * ```ts
 *
 *
 * app.service('users').hooks({
 *   before: { find: [disablePagination()] }
 * })
 * // Then call: app.service('users').find({ query: { $limit: -1 } })
 * ```
 *
 * @see https://utils.feathersjs.com/hooks/disable-pagination.html
 */
export declare const disablePagination: <
  H extends HookContext = HookContext,
>() => (context: H, next?: NextFunction) => any
typemethodsmulti
beforefindyes

Released under the MIT License.