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