We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2ebcb19 + 3577275 commit 7cb567bCopy full SHA for 7cb567b
1 file changed
src/hooks/6-normalize-find.ts
@@ -20,12 +20,14 @@ export function normalizeFind() {
20
21
next && await next()
22
23
- if (context.method === 'find' && !context.result?.data) {
+ // this makes sure it only affects finds that are not paginated and are not custom.
24
+ // so the custom find responses fall through.
25
+ if (context.method === 'find' && !context.result?.data && Array.isArray(context.result)) {
26
context.result = {
- data: [],
- limit: context.params.$limit,
27
- skip: context.params.$skip,
28
- total: 0,
+ data: context.result,
+ limit: context.params.$limit || context.result.length,
29
+ skip: context.params.$skip || 0,
30
+ total: context.result.length,
31
}
32
33
0 commit comments