Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

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 .md to 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.

TypeScript
const user = await prisma.user.findUnique({
  where: { id: 1 },
  omit: {
    password: true,
  },
});

You can also configure omit on the client itself:

TypeScript
const prisma = new PrismaClient({
  omit: {
    user: {
      password: true,
    },
  },
});
  • Use select when you want to return only a small subset of fields.
  • Use omit when the default result is mostly correct and you only want to remove a few sensitive or noisy fields.
  • 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 operations
  • 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.
  • Pagination: Learn how to paginate Prisma Client query results with offset pagination and cursor-based pagination.
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu