How can I return all posts from the user? but only...
# orm-help
a
How can I return all posts from the user? but only the post array not the user itself.
return prisma.user.findUnique({
where: {
id: args.id,
},
select: {
posts: true
},
})
The return type of the query is [Posts!] and I get this error
Expected Iterable, but did not find one for field \"Query.testQuery\"
I also tried to put “include” in the filter but it tells me I cannot use “select” and “include” at the same time
return prisma.user.findUnique({
where: {
id: args.id,
},
include: {
posts: true
},
select: {
posts: true
}
})