---
title: Omitting Fields
description: Control model row projections, client defaults, and per-query projections
icon: eye-off
---

`omit` is the inverse of [`select`](/docs/client/selecting): it returns every
readable scalar except the ones you name.

```ts
const users = await client.user.findMany({
  omit: { passwordHash: true },
});
// { id: string; email: string; name: string }[]
```

## Three owners

| Layer | Spelling | Meaning | Can a query undo it? |
|---|---|---|---|
| Model | `s.model({...}).omit({...})` | Exclude the scalar from model row projections | No |
| Client default | [`defaultOmit({...})`](/docs/extensions/omit) | Default projection on one derived client | Yes |
| Query | `findMany({ omit: {...} })` | Projection for one call | — |

### Model `.omit()`

Model omit excludes a field from returned model rows. The field has no `select` or
`omit` key and is not selected from the database:

```ts
const vault = s
  .model({ id: s.string().id(), label: s.string(), secret: s.string() })
  .omit({ secret: true });
```

Aggregates and `groupBy` can still return the field's values, and filters,
ordering, distinct and cursors can still use it. Do not use omit to protect a
secret from callers who can choose query arguments. Enforce those permissions
in your application or database.

### Client `defaultOmit()`

`defaultOmit()` is the official extension for a derived client's default
projection. See [Default omit](/docs/extensions/omit) for configuration,
overrides, nested results, and extension ordering.

## Query-level composition

Query omit works on operations returning model rows, including returning bulk
writes. `select` first names the candidate result, then `omit` subtracts scalar
fields. `include` adds relations, and every nested relation node owns its own
projection:

```ts
await client.user.findMany({
  omit: { passwordHash: true },
  include: {
    posts: { omit: { draftBody: true } },
  },
});
```

An omit that removes every readable field is refused. A widened boolean makes
the corresponding result key optional because runtime decides whether it is
present.

## Security boundary

Query omit and `defaultOmit()` are presentation defaults and are intentionally
overridable. Model `.omit()` makes the row projection exclusion permanent,
but none of the three authorizes access to fields, rows, relations or raw SQL.
Use [`viborm/permissions`](/docs/extensions/permissions) for authorization
rules enforced across the query graph. Its raw SQL and statement-transform
boundaries still apply.
