---
description: How to use the TriplitClient fetchOne method to query a single entity.
---

import { Callout } from 'nextra-theme-docs';

# fetchOne

`fetchOne` is similar to `fetch()` but will return only the first entity in the result set or `null` if the result set is empty. For example:

```typescript
await client.insert('employees', { id: 'Fry', name: 'Philip J. Fry' });
await client.insert('employees', { id: 'Leela', name: 'Turanga Leela' });

const query = client.query('employees').build();
const result = await client.fetchOne(query, options); // { name: 'Philip J. Fry' }

const queryEmpty = client
  .query('employees')
  .where('name', '=', 'Bender')
  .build();
const resultEmpty = await client.fetchOne(queryEmpty); // null
```

This is a convenient shorthand for using the [limit parameter](/client/query/limit) `.limit(1)` and extracting the result from the result set.
