so if a User has many Posts, I want to do `include...
# orm-help
n
so if a User has many Posts, I want to do
include: { posts: true}
on a user query but I only want the first post in the returned posts array, any way to do this?
1
n
Hey Nick 👋 yes, this is possible using the
take
argument inside of
include
. Here’s an example:
Copy code
await prisma.user.findMany({
  include: {
    posts: {
      take: 1
    }
  }
})
r
im glad found this post.
🎉 1