DocumentReference class

DocumentReference Firestore データベース内のドキュメントの場所を参照し、その場所の書き込み、読み取り、またはリスニングに使用できます。参照された場所にあるドキュメントは存在する場合もあれば、存在しない場合もあります。

サイン:

export declare class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> 

プロパティ

財産修飾子タイプ説明
コンバータFirestoreDataConverter <AppModelType、DbModelType> |ヌル指定された場合、このインスタンスに関連付けられたFirestoreDataConverter
消防署ファイヤーストアドキュメントが存在するFirestoreインスタンス。これは、トランザクションの実行などに役立ちます。
IDコレクション内のドキュメントの識別子。
コレクションリファレンス<AppModelType、DbModelType>このDocumentReferenceが属するコレクション。
パス参照ドキュメントのパス (データベースのルートからの相対パス) を表す文字列。
タイプ(宣言されていない)この Firestore 参照のタイプ。

メソッド

方法修飾子説明
withConverter(コンバーター)カスタム データ コンバータをこのDocumentReferenceに適用し、Firestore で独自のカスタム モデル オブジェクトを使用できるようにします。 setDoc()を呼び出すときgetDoc()など、返されたDocumentReferenceインスタンスを使用すると、提供されたコンバーターは、タイプNewDbModelTypeの Firestore データとカスタム タイプNewAppModelTypeの間で変換します。
withConverter(コンバーター)電流コンバータを取り外します。

DocumentReference.converter

指定された場合、このインスタンスに関連付けられたFirestoreDataConverter

サイン:

readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;

DocumentReference.firestore

ドキュメントが存在するFirestoreインスタンス。これは、トランザクションの実行などに役立ちます。

サイン:

readonly firestore: Firestore;

DocumentReference.id

コレクション内のドキュメントの識別子。

サイン:

get id(): string;

DocumentReference.parent

このDocumentReferenceが属するコレクション。

サイン:

get parent(): CollectionReference<AppModelType, DbModelType>;

DocumentReference.path

参照ドキュメントのパス (データベースのルートからの相対パス) を表す文字列。

サイン:

get path(): string;

DocumentReference.type

この Firestore 参照のタイプ。

サイン:

readonly type = "document";

DocumentReference.withConverter()

カスタム データ コンバータをこのDocumentReferenceに適用しますを使用すると、Firestore で独自のカスタム モデル オブジェクトを使用できるようになります。 setDoc()を呼び出すときgetDoc()など、返されたDocumentReferenceインスタンスを使用すると、提供されたコンバーターは、タイプNewDbModelTypeの Firestore データとカスタム タイプNewAppModelTypeの間で変換します。

サイン:

withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;

パラメーター

パラメータタイプ説明
コンバータFirestoreDataConverter <NewAppModelType、NewDbModelType> Firestore との間でオブジェクトを変換します。

戻り値:

ドキュメントリファレンス<NewAppModelType、NewDbModelType>

提供されたコンバータを使用するDocumentReference

DocumentReference.withConverter()

電流コンバータを取り外します。

サイン:

withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;

パラメーター

パラメータタイプ説明
コンバータヌルnull現在のコンバータを削除します。

戻り値:

ドキュメントリファレンス<ドキュメントデータドキュメントデータ>

コンバータを使用しないDocumentReference<DocumentData, DocumentData>