CollectionReference class

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로 변환하거나 Firestore에서 변환합니다.

보고:

컬렉션참조 <NewAppModelType, NewDbModelType>

제공된 변환기를 사용하는 CollectionReference 입니다.

CollectionReference.withConverter()

현재 변환기를 제거합니다.

서명:

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

매개변수

매개변수 유형 설명
변환기 없는 null 현재 변환기를 제거합니다.

보고:

컬렉션참조 < 문서데이터 , 문서데이터 >

변환기를 사용하지 않는 CollectionReference<DocumentData, DocumentData> .