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>
。