Aller au contenu

Unbounded Query No Limit (ARCH3061)

Ce contenu n’est pas encore disponible dans votre langue.

Key typescript.orm.unbounded-query-no-limit · Severity warning · Category orm

Fetching an entire table with no LIMIT/pagination risks memory blowup on large tables when the result feeds a list or response. Always bound the query.

async function listUsers() {
return await userRepo.find(); // entire table
}
async function listUsers(page = 0, size = 50) {
return await userRepo.find({ skip: page * size, take: size });
}

Add take/limit and pagination to bound the number of rows fetched.