5.0.16 • Published 6 months ago

@types/mongoose-paginate v5.0.16

Weekly downloads
5,151
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/mongoose-paginate

Summary

This package contains type definitions for mongoose-paginate (https://github.com/edwardhotchkiss/mongoose-paginate).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongoose-paginate.

index.d.ts

// Type definitions for mongoose-paginate 5.0.0
// Project: https://github.com/edwardhotchkiss/mongoose-paginate
// Definitions by: Linus Brolin <https://github.com/linusbrolin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 4.1

/// <reference types="mongoose" />

declare module 'mongoose' {
  export interface PaginateOptions {
    select?: Object | string | undefined;
    sort?: Object | string | undefined;
    populate?:
      | Array<Object>
      | Array<string>
      | Object
      | string
      | QueryPopulateOptions | undefined;
    lean?: boolean | undefined;
    leanWithId?: boolean | undefined;
    offset?: number | undefined;
    page?: number | undefined;
    limit?: number | undefined;
  }

  interface QueryPopulateOptions {
    /** space delimited path(s) to populate */
    path: string;
    /** optional fields to select */
    select?: any;
    /** optional query conditions to match */
    match?: any;
    /** optional model to use for population */
    model?: string | Model<any> | undefined;
    /** optional query options like sort, limit, etc */
    options?: any;
    /** deep populate */
    populate?: QueryPopulateOptions | QueryPopulateOptions[] | undefined;
  }

  export interface PaginateResult<T> {
    docs: Array<T>;
    total: number;
    limit: number;
    page?: number | undefined;
    pages?: number | undefined;
    offset?: number | undefined;
  }

  interface PaginateModel<T extends Document> extends Model<T> {
    paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult<T>) => void): Promise<PaginateResult<T>>;
  }

  export function model<T extends Document>(
    name: string,
    schema?: Schema,
    collection?: string,
    skipInit?: boolean): PaginateModel<T>;

  export function model<T extends Document, U extends PaginateModel<T>>(
    name: string,
    schema?: Schema,
    collection?: string,
    skipInit?: boolean): U;
}

declare module 'mongoose-paginate' {
  import mongoose = require('mongoose');
  var _: (schema: mongoose.Schema) => void;
  export = _;
}

Additional Details

  • Last updated: Sun, 24 Apr 2022 14:31:47 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Linus Brolin.

5.0.13

7 months ago

5.0.14

7 months ago

5.0.15

6 months ago

5.0.16

6 months ago

5.0.12

2 years ago

5.0.11

2 years ago

5.0.10

3 years ago

5.0.9

3 years ago

5.0.8

5 years ago

5.0.7

5 years ago

5.0.6

7 years ago

5.0.5

7 years ago

5.0.4

7 years ago

5.0.3

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago