express-mongoose-paginate
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

express-mongoose-paginate

mongoose 分页插件

安装

npm install express-mongoose-paginate

使用

import type { Schema, model } from 'mongoose'
import {
  PaginationModel,
  mongoosePagination
} from 'express-mongoose-paginate'

type IArticle = {
  title: string
  content: string
}

const articleSchema = new Schema(
  {
    title: { type: String },
    content: { type: String }
  }
)

articleSchema.plugin(mongoosePagination)

const Article: PaginationModel<IArticle> = model<
  IArticle,
  PaginationModel<IArticle>
>('Article', articleSchema)

Article.paginate()

Package Sidebar

Install

npm i express-mongoose-paginate

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

8.52 kB

Total Files

7

Last publish

Collaborators

  • evan97