<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [/](./firestore_.md) &gt; [getDocFromCache](./firestore_.getdocfromcache.md)

## getDocFromCache() function

Reads the document referred to by this `DocumentReference` from cache. Returns an error if the document is not currently cached.

<b>Signature:</b>

```typescript
export declare function getDocFromCache<T>(reference: DocumentReference<T>): Promise<DocumentSnapshot<T>>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  reference | [DocumentReference](./firestore_.documentreference.md)<!-- -->&lt;T&gt; |  |

<b>Returns:</b>

Promise&lt;[DocumentSnapshot](./firestore_.documentsnapshot.md)<!-- -->&lt;T&gt;&gt;

A Promise resolved with a `DocumentSnapshot` containing the current document contents.

