---
title: Default omit
description: Add typed default field omission to one derived client
icon: eye-off
---

`defaultOmit()` is the official extension for a client's default projection.
It changes one derived client's result types without changing the base client,
the model definition, or another client created from the same schema.

```ts
import { defaultOmit } from "viborm/client";

const publicClient = client.$extends(
  defaultOmit({
    user: { passwordHash: true },
    note: { draftBody: true },
  })
);
```

The configuration is typed against the client it is applied to. Model and
scalar names are checked exactly, and omitted entries must use the literal
value `true` (anything else is refused with a `ClientInitializationError`).
It is the `defaults` part's
[`omitted`](/docs/extensions/create#default-omission-omitted) word: an
extension of your own can omit fields the same way.

A chain applies `defaultOmit()` once: its name is fixed
(`viborm.defaultOmit`) and an extension's name is unique in a chain, so a
second `defaultOmit()` is refused with a `ClientInitializationError`, as any
extension applied twice is. Give the one application every field to leave
out. The omissions of different extensions
add up per model: an extension of your own that omits a field with
`defaults({ model: { fields: { field: omitted } } })` adds it to the fields
`defaultOmit()` leaves out.

## Results and overrides

Defaults apply to root model results and nested relation payloads. A query can
restore one defaulted field with `false`, or replace the default projection
with an explicit `select`:

```ts
await publicClient.user.findMany({
  omit: { passwordHash: false },
});

await publicClient.user.findMany({
  select: { id: true, passwordHash: true },
});
```

A default does not change a bulk operation from `{ count }` to returned rows.
Only a projection written on that bulk call requests rows.

For model row exclusions and one-query `omit`, see
[Omitting fields](/docs/client/omit).

## Ordering

The omission applies to every call of the chain, whatever its place. Because
it changes default result types, TypeScript refuses it after a part typed
against the result surface that exists when it is applied: a `methods` or
`modelMethods` factory that takes its `scope`, or an `around` that names one
model and one operation. It may follow anything else, the official
[`cache()`](/docs/extensions/cache) and
[`instrumentation()`](/docs/extensions/instrumentation) included. Apply
`defaultOmit()` before those parts
([compose](/docs/extensions/create#compose-extensions)).

## Not authorization

`defaultOmit()` is an overridable presentation default. It does not authorize
rows, relations, filters, writes, or raw SQL. Model `.omit()` excludes a field
from returned model rows, but aggregates can still expose it and filters can
still use it. Use database or application authorization for access control.
