Ir al contenido

Select Star Over Fetch (ARCH3066)

Esta página aún no está disponible en tu idioma.

Key typescript.orm.select-star-over-fetch · Severity info · Category orm

Fetching a full entity/all columns when only a few fields are used downstream increases row width and serialization cost. Use a projection (Select/values/DTO).

const users = await userRepo.find(); // all columns
return users.map(u => ({ id: u.id, name: u.name }));
const users = await userRepo.find({
select: { id: true, name: true },
});
return users;

Fetch only the needed fields with a select/projection.