You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the instructions in the guide, posts :: [Include "comments" Post] <- query @Post |> fetch >>= collectionFetchRelated #comments fails to compile: Couldn't match type ‘Id' "comments"’ with ‘QueryBuilder Comment’
Is the filter on the related models incorrectly using the related model's #id instead of the foreign key field?
This was my workaround: posts <- mapM (fetchRelated #comments) =<< query @Post |> findManyBy #id postId
The text was updated successfully, but these errors were encountered:
I think the problem is the targetForeignKey line. That requires that the parent model (second argument to collectionFetchRelated) being targeted is a Post' (Id' "comments"), while the result of the first fetch is Post' (QueryBuilder Comment).
Following the instructions in the guide,
posts :: [Include "comments" Post] <- query @Post |> fetch >>= collectionFetchRelated #comments
fails to compile:Couldn't match type ‘Id' "comments"’ with ‘QueryBuilder Comment’
Is the filter on the related models incorrectly using the related model's #id instead of the foreign key field?
This was my workaround:
posts <- mapM (fetchRelated #comments) =<< query @Post |> findManyBy #id postId
The text was updated successfully, but these errors were encountered: