File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -69,10 +69,15 @@ export const find: Find = async function find(
6969 }
7070 }
7171
72- if ( limit > 0 ) {
72+ if ( limit >= 0 ) {
7373 paginationOptions . limit = limit
7474 // limit must also be set here, it's ignored when pagination is false
7575 paginationOptions . options . limit = limit
76+
77+ // Disable pagination if limit is 0
78+ if ( limit === 0 ) {
79+ paginationOptions . pagination = false
80+ }
7681 }
7782
7883 const result = await Model . paginate ( query , paginationOptions )
Original file line number Diff line number Diff line change @@ -88,10 +88,15 @@ export const findGlobalVersions: FindGlobalVersions = async function findGlobalV
8888 }
8989 }
9090
91- if ( limit > 0 ) {
91+ if ( limit >= 0 ) {
9292 paginationOptions . limit = limit
9393 // limit must also be set here, it's ignored when pagination is false
9494 paginationOptions . options . limit = limit
95+
96+ // Disable pagination if limit is 0
97+ if ( limit === 0 ) {
98+ paginationOptions . pagination = false
99+ }
95100 }
96101
97102 const result = await Model . paginate ( query , paginationOptions )
Original file line number Diff line number Diff line change @@ -85,10 +85,15 @@ export const findVersions: FindVersions = async function findVersions(
8585 }
8686 }
8787
88- if ( limit > 0 ) {
88+ if ( limit >= 0 ) {
8989 paginationOptions . limit = limit
9090 // limit must also be set here, it's ignored when pagination is false
9191 paginationOptions . options . limit = limit
92+
93+ // Disable pagination if limit is 0
94+ if ( limit === 0 ) {
95+ paginationOptions . pagination = false
96+ }
9297 }
9398
9499 const result = await Model . paginate ( query , paginationOptions )
You can’t perform that action at this time.
0 commit comments