<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [/](./firestore_.md) &gt; [DocumentSnapshot](./firestore_.documentsnapshot.md)

## DocumentSnapshot class

A `DocumentSnapshot` contains data read from a document in your Firestore database. The data can be extracted with `.data()` or `.get(<field>)` to get a specific field.

For a `DocumentSnapshot` that points to a non-existing document, any data access will return 'undefined'. You can use the `exists()` method to explicitly verify a document's existence.

<b>Signature:</b>

```typescript
export declare class DocumentSnapshot<T = DocumentData> 
```

## Constructors

|  Constructor | Modifiers | Description |
|  --- | --- | --- |
|  [(constructor)()](./firestore_.documentsnapshot._constructor_.md) |  | Constructs a new instance of the <code>DocumentSnapshot</code> class |

## Properties

|  Property | Modifiers | Type | Description |
|  --- | --- | --- | --- |
|  [id](./firestore_.documentsnapshot.id.md) |  | string | Property of the <code>DocumentSnapshot</code> that provides the document's ID. |
|  [metadata](./firestore_.documentsnapshot.metadata.md) |  | [SnapshotMetadata](./firestore_.snapshotmetadata.md) | Metadata about the <code>DocumentSnapshot</code>, including information about its source and local modifications. |
|  [ref](./firestore_.documentsnapshot.ref.md) |  | [DocumentReference](./firestore_.documentreference.md)<!-- -->&lt;T&gt; | The <code>DocumentReference</code> for the document included in the <code>DocumentSnapshot</code>. |

## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  [data(options)](./firestore_.documentsnapshot.data.md) |  | Retrieves all fields in the document as an <code>Object</code>. Returns <code>undefined</code> if the document doesn't exist.<!-- -->By default, <code>FieldValue.serverTimestamp()</code> values that have not yet been set to their final value will be returned as <code>null</code>. You can override this by passing an options object. |
|  [exists()](./firestore_.documentsnapshot.exists.md) |  | Property of the <code>DocumentSnapshot</code> that signals whether or not the data exists. True if the document exists. |
|  [get(fieldPath, options)](./firestore_.documentsnapshot.get.md) |  | Retrieves the field specified by <code>fieldPath</code>. Returns <code>undefined</code> if the document or field doesn't exist.<!-- -->By default, a <code>FieldValue.serverTimestamp()</code> that has not yet been set to its final value will be returned as <code>null</code>. You can override this by passing an options object. |

