<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [lite](./firestore_lite.md) &gt; [DocumentSnapshot](./firestore_lite.documentsnapshot.md) &gt; [data](./firestore_lite.documentsnapshot.data.md)

## DocumentSnapshot.data() method

Retrieves all fields in the document as an `Object`<!-- -->. Returns `undefined` if the document doesn't exist.

<b>Signature:</b>

```typescript
data(): T | undefined;
```
<b>Returns:</b>

T \| undefined

An `Object` containing all fields in the document or `undefined` if the document doesn't exist.

