react-query-firebase / web/firestore / getDocData
Function: getDocData()
ts
function getDocData<AppModelType>(options): Promise<null | AppModelType & object>;
Defined in: web/firestore/utils/getDocData.ts:20
Asynchronously retrieves document data from a specified database reference. Utilizes the helper function getDocSnap
to fetch the document snapshot and checks if the document exists before returning its data.
Type Parameters
AppModelType
AppModelType
extends AppModel
= AppModel
Parameters
options
The options for fetching document data.
db
Firestore
path?
string
pathSegments?
string
[]
reference?
| CollectionReference
<AppModelType
, AppModelType
> | DocumentReference
<AppModelType
, AppModelType
>
Returns
Promise
<null
| AppModelType
& object
>
Returns a promise that resolves to the document data if it exists, or null if the document does not exist.