<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/firestore](./firestore.md) &gt; [/](./firestore_.md) &gt; [doc](./firestore_.doc.md)

## doc() function

Gets a `DocumentReference` instance that refers to the document at the specified abosulute path.

<b>Signature:</b>

```typescript
export declare function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  firestore | [FirebaseFirestore](./firestore_.firebasefirestore.md) | A reference to the root Firestore instance. |
|  path | string | A slash-separated path to a document. |
|  pathSegments | string\[\] | Additional path segments that will be applied relative to the first argument. |

<b>Returns:</b>

[DocumentReference](./firestore_.documentreference.md)<!-- -->&lt;[DocumentData](./firestore_.documentdata.md)<!-- -->&gt;

The `DocumentReference` instance.

## Exceptions

If the final path has an odd number of segments and does not point to a document.

