İçeriğe geç

Eksik Eager Load (ARCH3051)

Anahtar typescript.orm.missing-eager-load · Önem warning · Kategori orm

Bir sorgu sonucundaki ilişkili veriyi gezerken eager loading (Include/with/relations) bildirilmemişse, her erişim ayrı bir sorgu tetikler. Eager load, N+1’in standart önlemidir.

const posts = await postRepo.find();
const titles = posts.map(p => `${p.title} by ${p.author.name}`); // author lazy
const posts = await postRepo.find({ relations: { author: true } });
const titles = posts.map(p => `${p.title} by ${p.author.name}`);

İlişkiyi sorguda relations/include ile açıkça eager load edin.