---
title: findFirst
description: Find the first record matching a filter, or null
icon: search
---

`findFirst` returns the first record matching the filter, or `null` if none match. It takes the same options as [`findMany`](/docs/client/find-many) (`where`, `orderBy`, `select`, `include`, pagination) but returns a single record.

```ts
const user = await client.user.findFirst({
  where: { email: { contains: "alice" } },
});
// Type: User | null
```

Add an `orderBy` for a stable "first":

```ts
const newest = await client.post.findFirst({
  where: { published: true },
  orderBy: { createdAt: "desc" },
});
```

## findFirstOrThrow

Same as `findFirst`, but throws `NotFoundError` instead of returning `null`:

```ts
const user = await client.user.findFirstOrThrow({
  where: { email: "alice@example.com" },
});
// Type: User (never null)
```
