fix(db-mongodb): db.find default limit to 0 (#8376)
Fixes an error anytime a `db.find` is called on documents with joins without a set `limit` by defaulting the limit to 0.
This commit is contained in:
@@ -15,7 +15,7 @@ export const find: Find = async function find(
|
||||
{
|
||||
collection,
|
||||
joins = {},
|
||||
limit,
|
||||
limit = 0,
|
||||
locale,
|
||||
page,
|
||||
pagination,
|
||||
|
||||
@@ -111,9 +111,10 @@ export const buildJoinAggregation = async ({
|
||||
input: `$${as}.docs`,
|
||||
},
|
||||
}, // Slicing the docs to match the limit
|
||||
[`${as}.hasNextPage`]: {
|
||||
$gt: [{ $size: `$${as}.docs` }, limitJoin || Number.MAX_VALUE],
|
||||
}, // Boolean indicating if more docs than limit
|
||||
[`${as}.hasNextPage`]: limitJoin
|
||||
? { $gt: [{ $size: `$${as}.docs` }, limitJoin] }
|
||||
: false,
|
||||
// Boolean indicating if more docs than limit
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user