aravindnc / mongoose-paginate-v2

A custom pagination library for Mongoose with customizable labels.

Home Page:https://www.npmjs.com/package/mongoose-paginate-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paginate the subdocument of a schema

deepakkumardk opened this issue · comments

How to paginate the sub-document of a schema. The model has array of sub-document as of a book can have many authors and I want to paginate the authors.
How to achieve this.

Use aggregate and $unwind.

@deepakkumardk You can use my another plugin for aggregate pagination https://www.npmjs.com/package/mongoose-aggregate-paginate-v2