Select fields (Prisma ORM v7) (/docs/orm/v7/prisma-client/queries/select-fields)
For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending
.mdto its URL.
Learn how to return only the fields and relations you need with select and include in Prisma Client.
Location: ORM > v7 > Prisma Client > Queries > Select fields
By default, Prisma Client returns all scalar fields for a model and no relations. Use select and include to make the result smaller, clearer, and more intentional.
Return the default fields
Section titled “Return the default fields”If you do not pass select, include, or omit, Prisma Client returns all scalar fields for the model and excludes relations from the result.
Select specific fields
Section titled “Select specific fields”Use select when you only need a few scalar fields:
const user = await prisma.user.findFirst({
select: {
email: true,
name: true,
},
});Return nested objects by selecting relation fields
Section titled “Return nested objects by selecting relation fields”Use include when you want related records alongside the main result:
const user = await prisma.user.findFirst({
include: {
posts: true,
},
});Nest selections
Section titled “Nest selections”You can combine both patterns to keep relation payloads focused:
const user = await prisma.user.findFirst({
select: {
email: true,
posts: {
select: {
title: true,
published: true,
},
},
},
});Omit fields instead of selecting everything manually
Section titled “Omit fields instead of selecting everything manually”If you mostly want the default result but need to exclude a few fields, see Excluding fields.
Related pages
Section titled “Related pages”Related pages
Section titled “Related pages”Aggregation, grouping, and summarizing: Use Prisma Client to aggregate, group by, count, and select distinct.CRUD: Learn how to perform create, read, update, and delete operationsExcluding fields: Learn how to exclude fields from Prisma Client results with the omit option.Filtering and sorting: Learn how to filter Prisma Client queries with where and sort results with orderBy.Full-text search: Learn how to search text fields with Prisma Client using your database's native full-text search support.