CollectionReference
オブジェクトは、ドキュメントの追加、ドキュメント参照の取得、およびドキュメントのクエリ ( query()を使用) に使用できます。 )。
サイン:
export declare class CollectionReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> extends Query<AppModelType, DbModelType>
拡張:クエリ<AppModelType、DbModelType>
プロパティ
財産 | 修飾子 | タイプ | 説明 |
---|---|---|---|
ID | 弦 | コレクションの識別子。 | |
親 | ドキュメントリファレンス<ドキュメントデータ、ドキュメントデータ> |ヌル | これがサブコレクションの場合、含まれるDocumentReference への参照。これがサブコレクションではない場合、参照は null です。 | |
パス | 弦 | 参照されるコレクションのパス (データベースのルートからの相対パス) を表す文字列。 | |
タイプ | (宣言されていない) | この Firestore 参照のタイプ。 |
メソッド
方法 | 修飾子 | 説明 |
---|---|---|
withConverter(コンバーター) | カスタム データ コンバータをこのCollectionReference に適用し、Firestore で独自のカスタム モデル オブジェクトを使用できるようにします。返されたCollectionReference インスタンスを使用してaddDoc()を呼び出すと、提供されたコンバーターによって、タイプNewDbModelType の Firestore データとカスタム タイプNewAppModelType の間で変換が行われます。 | |
withConverter(コンバーター) | 電流コンバータを取り外します。 |
CollectionReference.id
コレクションの識別子。
サイン:
get id(): string;
CollectionReference.parent
これがサブコレクションの場合、含まれるDocumentReference
への参照。これがサブコレクションではない場合、参照は null です。
サイン:
get parent(): DocumentReference<DocumentData, DocumentData> | null;
CollectionReference.path
参照されるコレクションのパス (データベースのルートからの相対パス) を表す文字列。
サイン:
get path(): string;
CollectionReference.type
この Firestore 参照のタイプ。
サイン:
readonly type = "collection";
CollectionReference.withConverter()
カスタム データ コンバータをこのCollectionReference
に適用しますを使用すると、Firestore で独自のカスタム モデル オブジェクトを使用できるようになります。返されたCollectionReference
インスタンスを使用してaddDoc()を呼び出すと、提供されたコンバーターによって、タイプNewDbModelType
の Firestore データとカスタム タイプNewAppModelType
の間で変換が行われます。 。
サイン:
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): CollectionReference<NewAppModelType, NewDbModelType>;
パラメーター
パラメータ | タイプ | 説明 |
---|---|---|
コンバータ | FirestoreDataConverter <NewAppModelType、NewDbModelType> | Firestore との間でオブジェクトを変換します。 |
戻り値:
コレクションリファレンス<NewAppModelType、NewDbModelType>
提供されたコンバータを使用するCollectionReference
。
CollectionReference.withConverter()
電流コンバータを取り外します。
サイン:
withConverter(converter: null): CollectionReference<DocumentData, DocumentData>;
パラメーター
パラメータ | タイプ | 説明 |
---|---|---|
コンバータ | ヌル | null 現在のコンバータを削除します。 |
戻り値:
コレクションリファレンス<ドキュメントデータ、ドキュメントデータ>
コンバータを使用しないCollectionReference<DocumentData, DocumentData>
。