Excluding fields (Prisma ORM v7) (/docs/orm/v7/prisma-client/queries/excluding-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 exclude fields from Prisma Client results with the omit option.
Location: ORM > v7 > Prisma Client > Queries > Excluding fields
Use omit when you want Prisma Client to return the normal result shape except for a few specific fields.
Omit a field for one query
Section titled “Omit a field for one query”const user = await prisma.user.findUnique({
where: { id: 1 },
omit: {
password: true,
},
});Omit fields globally
Section titled “Omit fields globally”You can also configure omit on the client itself:
const prisma = new PrismaClient({
omit: {
user: {
password: true,
},
},
});When to use omit vs select
Section titled “When to use omit vs select”- Use
selectwhen you want to return only a small subset of fields. - Use
omitwhen the default result is mostly correct and you only want to remove a few sensitive or noisy 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 operationsFiltering 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.Pagination: Learn how to paginate Prisma Client query results with offset pagination and cursor-based pagination.