Closed CristianCardosoA closed 1 year ago
Why not just eager load the children?
I would need to do this instead:
for course in courses {
try await course.$sections.load(on: database)
}
let courses = try await Course.query(on: database) .filter(\.$lang == lang.rawValue) .sort(\.$title) .with(\.$sections) .all()
Hello, I'm trying to create a query to obtain "courses" table and "sections", but I need to call
map $sections.load(database)
to obtain those records.Is there any option to achieve this instead of calling
map
withload()
?Note:
asyncMap
is a custom extension, otherwise I need to change return type to:[EventLoopFuture<[Course]>]
Versions: