UNPKG

@amirmarmul/waba-common

Version:

![GitHub release](https://img.shields.io/github/v/release/amirmarmul/waba-common?style=flat-square)

30 lines (29 loc) 805 B
import { Schema, Model } from 'mongoose'; export declare class CursorPaginationModel<T> { meta: { cursors?: { next?: string | undefined; previous?: string | undefined; }; limit: number; }; docs: T[]; } export interface CursorPaginationOptions { query?: any; aggregate?: any; populate?: any; select?: any; search?: { value: string | undefined; fields: string[] | undefined; }; sort?: any; projection?: any; cursor?: string; limit?: string; } export interface CursorPagination<T> extends Model<T> { cursor(options?: CursorPaginationOptions, onError?: Function): Promise<CursorPaginationModel<T> | undefined>; } export declare function mongooseCursorPaginate<T>(schema: Schema<T>): void;