@firebase/firestore

기능

기능 설명
기능(앱, ...)
getFirestore(앱) 제공된 FirebaseApp 과 연결된 기존 기본 Firestore 인스턴스를 반환합니다. . 인스턴스가 없으면 기본 설정으로 새 인스턴스를 초기화합니다.
getFirestore(앱, 데이터베이스 ID) (베타) 제공된 FirebaseApp 과 연결된 기존의 명명된 Firestore 인스턴스를 반환합니다. . 인스턴스가 없으면 기본 설정으로 새 인스턴스를 초기화합니다.
초기화Firestore(앱, 설정, 데이터베이스Id) 제공된 설정을 사용하여 Firestore 의 새 인스턴스를 초기화합니다. getFirestore()를 포함한 다른 함수보다 먼저 호출될 수 있습니다. . 사용자 정의 설정이 비어 있는 경우 이 함수는 getFirestore()를 호출하는 것과 동일합니다. .
함수(firestore, ...)
ClearIndexedDbPersistence(firestore) 영구 저장소를 지웁니다. 여기에는 보류 중인 쓰기 및 캐시된 문서가 포함됩니다. Firestore 인스턴스가 시작되지 않은 동안(앱이 종료된 후 또는 앱이 처음 초기화될 때) 호출되어야 합니다. 시작 시 이 함수는 초기화Firestore() 또는 getFirestore() 이외의 다른 함수보다 먼저 호출되어야 합니다. )). Firestore 인스턴스가 아직 실행 중이면 failed-precondition 오류 코드와 함께 Promise가 거부됩니다. 참고: clearIndexedDbPersistence() 주로 Cloud Firestore를 사용하는 안정적인 테스트를 작성하는 데 도움을 주기 위한 것입니다. 기존 데이터를 삭제하기 위한 효율적인 메커니즘을 사용하지만 안전하게 덮어쓰거나 캐시된 데이터를 복구할 수 없게 만들지는 않습니다. 사용자 세션 간 캐시된 데이터 공개에 민감한 애플리케이션의 경우 지속성을 전혀 활성화하지 않는 것이 좋습니다.
컬렉션(firestore, 경로, pathSegments) 지정된 절대 경로에 있는 컬렉션을 참조하는 CollectionReference 인스턴스를 가져옵니다.
collectionGroup(firestore, collectionId) 지정된 collectionId 있는 컬렉션 또는 하위 컬렉션에 포함된 데이터베이스의 모든 문서를 포함하는 새 Query 인스턴스를 생성하고 반환합니다.
connectFirestoreEmulator(firestore, 호스트, 포트, 옵션) Cloud Firestore 에뮬레이터와 통신하도록 이 인스턴스를 수정하세요. 참고: 이 인스턴스를 사용하여 작업을 수행하기 전에 호출해야 합니다.
비활성화 네트워크(firestore) 이 인스턴스의 네트워크 사용을 비활성화합니다. 활성화네트워크()를 통해 다시 활성화할 수 있습니다. . 네트워크가 비활성화된 동안 모든 스냅샷 수신기, getDoc() 또는 getDocs() 호출은 캐시에서 결과를 반환하고 모든 쓰기 작업은 네트워크가 복원될 때까지 대기열에 대기됩니다.
doc(firestore, 경로, pathSegments) 지정된 절대 경로에 있는 문서를 참조하는 DocumentReference 인스턴스를 가져옵니다.
활성화IndexedDbPersistence(firestore, persistenceSettings) 가능하다면 영구 저장소를 활성화하려고 시도합니다. 실패 시, enableIndexedDbPersistence() 약속을 거부하거나 예외를 발생시킵니다. 이것이 실패할 수 있는 몇 가지 이유가 있으며, 이는 오류의 code 로 식별할 수 있습니다. * 실패 전제 조건: 앱이 이미 다른 브라우저 탭에 열려 있습니다. * 구현되지 않음: 브라우저가 오프라인 지속성 구현과 호환되지 않습니다. 장애가 발생한 후에도 Firestore 인스턴스는 계속 사용할 수 있지만 오프라인 지속성은 비활성화됩니다. 참고: enableIndexedDbPersistence() 다른 함수( initialFirestore() 제외)보다 먼저 호출되어야 합니다. , getFirestore() 또는 clearIndexedDbPersistence() . Node.js 환경에서는 지속성을 사용할 수 없습니다.
활성화MultiTabIndexedDbPersistence(firestore) 가능한 경우 다중 탭 영구 저장소를 활성화하려고 시도합니다. 모든 탭에서 활성화되면 연결된 모든 인스턴스에서 쿼리의 공유 실행 및 대기 시간 보상 로컬 문서 업데이트를 포함하여 모든 작업이 로컬 지속성에 대한 액세스를 공유합니다. 실패하면 enableMultiTabIndexedDbPersistence() 약속을 거부하거나 예외를 발생시킵니다. 이것이 실패할 수 있는 몇 가지 이유가 있으며, 이는 오류의 code 로 식별할 수 있습니다. * 실패 전제조건: 앱이 이미 다른 브라우저 탭에 열려 있고 멀티탭이 활성화되어 있지 않습니다. * 구현되지 않음: 브라우저가 오프라인 지속성 구현과 호환되지 않습니다. 장애가 발생한 후에도 Firestore 인스턴스는 계속 사용할 수 있지만 오프라인 지속성은 비활성화됩니다.
활성화 네트워크(firestore) 이전에 비활성화 네트워크()를 호출한 후 이 Firestore 인스턴스의 네트워크 사용을 다시 활성화합니다. .
getPertantCacheIndexManager(firestore) 지정된 Firestore 객체에서 사용하는 PertantCache 색인 관리자를 반환합니다. PersistentCacheIndexManager 인스턴스이거나, 로컬 영구 저장소를 사용하지 않는 경우 null .
loadBundle(firestore, BundleData) Firestore 번들을 로컬 캐시에 로드합니다.
명명된 쿼리(firestore, 이름) 지정된 이름으로 식별되는 로컬 캐시에서 Firestore 쿼리를 읽습니다. 명명된 쿼리는 결과 문서와 함께 서버 측에서 번들로 패키지되고 loadBundle 을 사용하여 로컬 캐시에 로드됩니다. 로컬 캐시에 있으면 이 방법을 사용하여 이름으로 쿼리를 추출합니다.
onSnapshotsInSync(firestore, 관찰자) snapshots-in-sync 이벤트에 대한 리스너를 연결합니다. snapshots-in-sync 이벤트는 단일 서버 생성 변경 사항이 여러 리스너에 영향을 주더라도 특정 변경 사항의 영향을 받는 모든 리스너가 실행되었음을 나타냅니다. 참고: snapshots-in-sync 이벤트는 리스너가 서로 동기화되어 있음을 나타낼 뿐이며 해당 스냅샷이 서버와 동기화되어 있는지 여부와는 관련이 없습니다. 개별 리스너에서 SnapshotMetadata를 사용하여 스냅샷이 캐시에서 가져온 것인지 서버에서 가져온 것인지 확인합니다.
onSnapshotsInSync(firestore, onSync) snapshots-in-sync 이벤트에 대한 리스너를 연결합니다. snapshots-in-sync 이벤트는 단일 서버 생성 변경 사항이 여러 리스너에 영향을 주더라도 특정 변경 사항의 영향을 받는 모든 리스너가 실행되었음을 나타냅니다. 참고: snapshots-in-sync 이벤트는 리스너가 서로 동기화되어 있음을 나타낼 뿐이며 해당 스냅샷이 서버와 동기화되어 있는지 여부와는 관련이 없습니다. 개별 리스너에서 SnapshotMetadata 사용하여 스냅샷이 캐시에서 가져온 것인지 서버에서 가져온 것인지 확인합니다.
runTransaction(firestore, updateFunction, 옵션) 지정된 updateFunction 실행한 다음 트랜잭션 내에 적용된 변경 사항을 커밋하려고 시도합니다. 트랜잭션 내에서 읽은 문서가 변경된 경우 Cloud Firestore는 updateFunction 을 다시 시도합니다. 5번 시도 후에도 커밋에 실패하면 트랜잭션이 실패합니다. 단일 트랜잭션에 허용되는 최대 쓰기 수는 500입니다.
setIndexConfiguration(firestore, 구성) (베타) 로컬 쿼리 실행을 위한 색인 생성을 구성합니다. 이전 인덱스 구성이 재정의됩니다. 인덱스 구성이 지속되면 Promise 해결됩니다. 인덱스 항목 자체는 비동기적으로 생성됩니다. 인덱스를 아직 사용할 수 없더라도 인덱싱이 필요한 쿼리를 계속 사용할 수 있습니다. 인덱스 항목이 작성되면 인덱스를 사용하여 쿼리 실행이 자동으로 시작됩니다. 인덱스는 IndexedDb 지속성에서만 지원됩니다. IndexedDb가 활성화되지 않으면 모든 인덱스 구성이 무시됩니다.
setIndexConfiguration(firestore, json) (베타) 로컬 쿼리 실행을 위한 색인 생성을 구성합니다. 이전 인덱스 구성이 재정의됩니다. 인덱스 구성이 지속되면 Promise 해결됩니다. 인덱스 항목 자체는 비동기적으로 생성됩니다. 인덱스를 아직 사용할 수 없더라도 인덱싱이 필요한 쿼리를 계속 사용할 수 있습니다. 인덱스 항목이 작성되면 인덱스를 사용하여 쿼리 실행이 자동으로 시작됩니다. 인덱스는 IndexedDb 지속성에서만 지원됩니다. 인덱스 구성을 설정하기 전에 enableIndexedDbPersistence() 또는 enableMultiTabIndexedDbPersistence() 호출하십시오. IndexedDb가 활성화되지 않으면 모든 인덱스 구성이 무시됩니다. 이 메서드는 Firebase CLI( firebase firestore:indexes )에서 내보낸 JSON 형식을 허용합니다. JSON 형식이 유효하지 않은 경우 이 메서드는 오류를 발생시킵니다.
종료(firestore) 제공된 Firestore 인스턴스를 종료합니다. terminate() 호출한 후에는 clearIndexedDbPersistence() 함수만 사용할 수 있습니다. 다른 함수에서는 FirestoreError 가 발생합니다. 종료 후 다시 시작하려면 getFirestore()를 사용하여 FirebaseFirestore의 새 인스턴스를 만듭니다. . 종료는 보류 중인 쓰기를 취소하지 않으며 서버의 응답을 기다리는 모든 약속은 해결되지 않습니다. 지속성을 활성화한 경우 다음에 이 인스턴스를 시작할 때 이러한 쓰기를 서버에 보내기가 다시 시작됩니다. 참고: 일반적인 상황에서는 terminate() 호출이 필요하지 않습니다. 이 함수는 이 인스턴스가 모든 리소스를 강제로 해제하도록 하거나 테스트 실행 사이에 모든 로컬 상태가 삭제되도록 하려면 clearIndexedDbPersistence() 와 함께 사용하려는 경우에만 유용합니다.
waitForPendingWrites(firestore) 활성 사용자에 대해 현재 보류 중인 모든 쓰기가 백엔드에서 승인될 때까지 기다립니다. 반환된 Promise는 미해결 쓰기가 없으면 즉시 해결됩니다. 그렇지 않으면 Promise는 이전에 실행된 모든 쓰기(이전 앱 세션에서 작성된 쓰기 포함)를 기다리지만 함수가 호출된 후에 추가된 쓰기는 기다리지 않습니다. 추가 쓰기를 기다리려면 waitForPendingWrites() 다시 호출하세요. 사용자 변경 중에는 처리되지 않은 waitForPendingWrites() 약속이 거부됩니다.
writeBatch(파이어스토어) 단일 원자성 작업으로 여러 쓰기를 수행하는 데 사용되는 쓰기 일괄 처리를 만듭니다. 단일 WriteBatch 에 허용되는 최대 쓰기 수는 500입니다. 트랜잭션과 달리 쓰기 배치는 오프라인으로 유지되므로 읽기 데이터에 대한 쓰기 조건을 조정할 필요가 없을 때 선호됩니다.
기능()
세다() 쿼리 결과 집합의 문서 수를 계산하는 데 사용할 수 있는 AggregateField 개체를 만듭니다.
삭제필드() 필드를 삭제 표시하기 위해 {merge: true} 와 함께 updateDoc() 또는 setDoc() 과 함께 사용할 센티널을 반환합니다.
문서ID() 문서의 ID를 참조하기 위해 특수 감시 FieldPath 반환합니다. 문서 ID를 기준으로 정렬하거나 필터링하는 쿼리에서 사용할 수 있습니다.
getFirestore() 기본 FirebaseApp 과 연결된 기존 기본 Firestore 인스턴스를 반환합니다. . 인스턴스가 없으면 기본 설정으로 새 인스턴스를 초기화합니다.
memoryEagerGarbageCollector() MemoryEagerGarbageCollector 인스턴스를 생성합니다. 이는 달리 명시적으로 지정되지 않는 한 기본 가비지 수집기이기도 합니다.
지속적MultipleTabManager() PersistentMultipleTabManager 의 인스턴스를 생성합니다.
서버타임스탬프() 작성된 데이터에 서버 생성 타임스탬프를 포함하기 위해 setDoc() 또는 updateDoc() 과 함께 사용되는 센티널을 반환합니다.
함수(데이터베이스 ID, ...)
getFirestore(데이터베이스 ID) (베타) 기본 FirebaseApp 과 연결된 기존의 명명된 Firestore 인스턴스를 반환합니다. . 인스턴스가 없으면 기본 설정으로 새 인스턴스를 초기화합니다.
함수(요소, ...)
배열제거(요소) setDoc() 과 함께 사용할 수 있거나 서버에 이미 존재하는 배열 값에서 지정된 요소를 제거하도록 서버에 지시하는 특수 값을 반환합니다. 지정된 각 요소의 모든 인스턴스가 배열에서 제거됩니다. 수정 중인 필드가 아직 배열이 아닌 경우 빈 배열로 덮어쓰게 됩니다.
arrayUnion(요소) 서버에 이미 존재하는 배열 값과 지정된 요소를 결합하도록 서버에 지시하는 setDoc() 또는 updateDoc() 과 함께 사용할 수 있는 특수 값을 반환합니다. 배열에 아직 존재하지 않는 지정된 각 요소는 끝에 추가됩니다. 수정 중인 필드가 아직 배열이 아닌 경우 지정된 요소를 정확히 포함하는 배열로 덮어쓰게 됩니다.
함수(필드, ...)
평균(필드) 쿼리 결과 집합의 문서 범위에 대해 지정된 필드의 평균을 계산하는 데 사용할 수 있는 AggregateField 개체를 만듭니다.
합계(필드) 쿼리 결과 집합의 문서 범위에 대해 지정된 필드의 합계를 계산하는 데 사용할 수 있는 AggregateField 개체를 만듭니다.
함수(필드 경로, ...)
orderBy(필드경로, 방향Str) 지정된 필드를 기준으로 쿼리 결과를 정렬하고 선택적으로 오름차순 대신 내림차순으로 정렬하는 QueryOrderByConstraint 를 만듭니다. 참고: 지정된 필드를 포함하지 않는 문서는 쿼리 결과에 표시되지 않습니다.
어디에(fieldPath, opStr, 값) 문서에 지정된 필드가 포함되어야 하고 값이 제공된 관계 제약 조건을 충족해야 한다고 적용하는 QueryFieldFilterConstraint 를 만듭니다.
함수(필드값, ...)
endAt(필드값) 쿼리 순서에 따라 제공된 필드에서 끝나도록 결과 집합을 수정하는 QueryEndAtConstraint 를 만듭니다. 필드 값의 순서는 쿼리의 order by 절 순서와 일치해야 합니다.
endBefore(필드값) 쿼리 순서에 따라 제공된 필드 앞에서 끝나도록 결과 집합을 수정하는 QueryEndAtConstraint 를 만듭니다. 필드 값의 순서는 쿼리의 order by 절 순서와 일치해야 합니다.
startAfter(필드값) 쿼리 순서에 따라 제공된 필드 다음에 시작되도록 결과 집합을 수정하는 QueryStartAtConstraint 를 만듭니다. 필드 값의 순서는 쿼리의 order by 절 순서와 일치해야 합니다.
시작(필드값) 쿼리 순서에 따라 제공된 필드에서 시작하도록 결과 집합을 수정하는 QueryStartAtConstraint 를 만듭니다. 필드 값의 순서는 쿼리의 order by 절 순서와 일치해야 합니다.
함수(indexManager, ...)
deleteAllPerciousCacheIndexes(indexManager) 모든 영구 캐시 인덱스를 제거합니다. 이 함수는 더 이상 사용되지 않는 setIndexConfiguration() 에 의해 생성된 인덱스도 삭제합니다.
비활성화PertantCacheIndexAutoCreation(indexManager) 로컬 쿼리 실행을 위해 자동으로 영구 캐시 인덱스 생성을 중지합니다. enablePersistentCacheIndexAutoCreation() 을 호출하여 생성된 인덱스는 계속 적용됩니다.
활성화PertantCacheIndexAutoCreation(indexManager) SDK가 캐시 인덱스가 성능 향상에 도움이 될 수 있다고 판단하는 경우 SDK가 로컬 쿼리 실행을 위해 영구 캐시 인덱스를 자동으로 생성할 수 있도록 합니다. 이 기능은 기본적으로 비활성화되어 있습니다.
함수(왼쪽, ...)
AggregateFieldEqual(왼쪽, 오른쪽) 두 개의 'AggregateField를 비교합니다. ` 평등을 위한 사례.
AggregateQuerySnapshotEqual(왼쪽, 오른쪽)AggregateQuerySnapshot 인스턴스가 같은지 비교합니다. 두 개의 AggregateQuerySnapshot 인스턴스는 동일하고 동일한 데이터를 비교하는 기본 쿼리가 있는 경우 "동등"한 것으로 간주됩니다.
queryEqual(왼쪽, 오른쪽) 제공된 쿼리가 동일한 컬렉션을 가리키고 동일한 제약 조건을 적용하는 경우 true를 반환합니다.
refEqual(왼쪽, 오른쪽) 제공된 참조가 동일한 경우 true를 반환합니다.
snapshotEqual(왼쪽, 오른쪽) 제공된 스냅샷이 동일한 경우 true를 반환합니다.
함수(한계, ...)
한도(한도) 일치하는 첫 번째 문서만 반환하는 QueryLimitConstraint 를 만듭니다.
LimitToLast(한계) 마지막으로 일치하는 문서만 반환하는 QueryLimitConstraint 를 만듭니다. limitToLast 쿼리에 대해 하나 이상의 orderBy 절을 지정해야 합니다. 그렇지 않으면 실행 중에 예외가 발생합니다.
함수(로그레벨, ...)
setLogLevel(로그레벨) Cloud Firestore 로그의 상세 수준(디버그, 오류, 자동)을 설정합니다.
함수(n, ...)
증분(n) 주어진 값만큼 필드의 현재 값을 증가시키도록 서버에 지시하는 setDoc() 또는 updateDoc() 과 함께 사용할 수 있는 특수 값을 반환합니다. 피연산자 또는 현재 필드 값이 부동 소수점 정밀도를 사용하는 경우 모든 산술은 IEEE 754 의미 체계를 따릅니다. 두 값이 모두 정수인 경우 JavaScript의 안전한 숫자 범위( Number.MIN_SAFE_INTEGER ~ Number.MAX_SAFE_INTEGER )를 벗어난 값도 정밀도가 손실될 수 있습니다. 또한 Firestore 백엔드에서 처리되면 모든 정수 연산은 -2^63에서 2^63-1 사이로 제한됩니다. 현재 필드 값이 number 유형이 아니거나 필드가 아직 존재하지 않는 경우 변환은 필드를 지정된 값으로 설정합니다.
함수(쿼리, ...)
getAggregateFromServer(쿼리, AggregateSpec) 실제로 문서를 다운로드하지 않고 지정된 쿼리의 결과 집합에 있는 문서에 대해 지정된 집계를 계산합니다. 이 기능을 사용하면 문서의 데이터가 아닌 최종 집계 값만 다운로드되므로 효율적으로 집계할 수 있습니다. 이 기능은 결과 집합이 완전히 다운로드하기에는 너무 큰 경우(수천 개의 문서) 문서의 집계를 수행할 수 있습니다. 서버에서 받은 결과는 로컬 상태를 고려하지 않고 변경되지 않은 상태로 표시됩니다. 즉, 로컬 캐시의 문서는 고려되지 않으며 로컬 수정 사항도 아직 서버와 동기화되지 않습니다. 이전에 다운로드한 결과가 있는 경우에는 사용되지 않습니다. 이 함수를 호출할 때마다 반드시 서버로의 왕복이 필요합니다.
getCountFromServer(쿼리) 실제로 문서를 다운로드하지 않고 주어진 쿼리의 결과 집합에 있는 문서 수를 계산합니다. 이 기능을 사용하면 문서의 데이터가 아닌 최종 집계만 다운로드되므로 효율적입니다. 이 기능은 결과 집합이 완전히 다운로드하기에는 너무 큰 경우(수천 개의 문서) 문서 수를 계산할 수 있습니다. 서버에서 받은 결과는 로컬 상태를 고려하지 않고 변경되지 않은 상태로 표시됩니다. 즉, 로컬 캐시의 문서는 고려되지 않으며 로컬 수정 사항도 아직 서버와 동기화되지 않습니다. 이전에 다운로드한 결과가 있는 경우에는 사용되지 않습니다. 이 함수를 호출할 때마다 반드시 서버로의 왕복이 필요합니다.
getDocs(쿼리) 쿼리를 실행하고 결과를 QuerySnapshot 으로 반환합니다. 참고: getDocs() 가능한 경우 서버에서 데이터를 기다려 최신 데이터를 제공하려고 시도하지만 오프라인 상태이고 서버에 연결할 수 없는 경우 캐시된 데이터를 반환하거나 실패할 수 있습니다. 이 동작을 지정하려면 getDocsFromCache() 또는 getDocsFromServer()를 호출합니다. .
getDocsFromCache(쿼리) 쿼리를 실행하고 결과를 캐시에서 QuerySnapshot 으로 반환합니다. 쿼리와 일치하는 문서가 현재 캐시되어 있지 않으면 빈 결과 집합을 반환합니다.
getDocsFromServer(쿼리) 쿼리를 실행하고 서버에서 결과를 QuerySnapshot 으로 반환합니다. 네트워크를 사용할 수 없으면 오류를 반환합니다.
onSnapshot(쿼리, 관찰자) QuerySnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. onSnapshot 호출 시 반환되는 함수를 호출하여 리스너를 취소할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(쿼리, 옵션, 관찰자) QuerySnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. onSnapshot 호출 시 반환되는 함수를 호출하여 리스너를 취소할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(쿼리, onNext, onError, onCompletion) QuerySnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. onSnapshot 호출 시 반환되는 함수를 호출하여 리스너를 취소할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(쿼리, 옵션, onNext, onError, onCompletion) QuerySnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. onSnapshot 호출 시 반환되는 함수를 호출하여 리스너를 취소할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
쿼리(쿼리, 복합 필터, 쿼리 제약 조건) 추가 쿼리 제약 조건도 포함하도록 확장된 Query 의 변경할 수 없는 새 인스턴스를 만듭니다.
쿼리(쿼리, 쿼리제약조건) 추가 쿼리 제약 조건도 포함하도록 확장된 Query 의 변경할 수 없는 새 인스턴스를 만듭니다.
함수(쿼리제약조건, ...)
및(쿼리제약조건) 지정된 필터 제약 조건을 결합한 새 QueryCompositeFilterConstraint 를 만듭니다. 결합 필터는 주어진 필터를 모두 만족하는 경우 문서를 포함합니다.
또는(쿼리제약조건) 지정된 필터 제약 조건의 분리인 새 QueryCompositeFilterConstraint 를 만듭니다. 분리 필터는 주어진 필터 중 하나를 만족하는 경우 문서를 포함합니다.
함수(참조, ...)
addDoc(참조, 데이터) 지정된 데이터를 사용하여 지정된 CollectionReference 에 새 문서를 추가하고 문서 ID를 자동으로 할당합니다.
컬렉션(참조, 경로, 경로세그먼트) 지정된 상대 경로에 있는 reference 의 하위 컬렉션을 참조하는 CollectionReference 인스턴스를 가져옵니다.
컬렉션(참조, 경로, 경로세그먼트) 지정된 상대 경로에 있는 reference 의 하위 컬렉션을 참조하는 CollectionReference 인스턴스를 가져옵니다.
deleteDoc(참조) 지정된 DocumentReference 에서 참조하는 문서를 삭제합니다.
doc(참조, 경로, pathSegments) 지정된 상대 경로에 있는 reference 내의 문서를 참조하는 DocumentReference 인스턴스를 가져옵니다. 경로가 지정되지 않으면 자동으로 생성된 고유 ID가 반환된 DocumentReference 에 사용됩니다.
doc(참조, 경로, pathSegments) 지정된 상대 경로에 있는 reference 내의 문서를 참조하는 DocumentReference 인스턴스를 가져옵니다.
getDoc(참조)DocumentReference 에서 참조하는 문서를 읽습니다. 참고: getDoc() 서버에서 데이터를 기다리면서 가능한 경우 최신 데이터를 제공하려고 시도하지만 오프라인 상태이고 서버에 연결할 수 없는 경우 캐시된 데이터를 반환하거나 실패할 수 있습니다. 이 동작을 지정하려면 getDocFromCache() 또는 getDocFromServer()를 호출합니다. .
getDocFromCache(참조) 캐시에서 이 DocumentReference 가 참조하는 문서를 읽습니다. 문서가 현재 캐시되지 않은 경우 오류를 반환합니다.
getDocFromServer(참조) 서버에서 이 DocumentReference 가 참조하는 문서를 읽습니다. 네트워크를 사용할 수 없으면 오류를 반환합니다.
onSnapshot(참조, 관찰자) DocumentSnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(참조, 옵션, 관찰자) DocumentSnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(참조, onNext, onError, onCompletion) DocumentSnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
onSnapshot(참조, 옵션, onNext, onError, onCompletion) DocumentSnapshot 이벤트에 대한 리스너를 연결합니다. 개별 onNextonError 콜백을 전달하거나 nexterror 콜백이 포함된 단일 관찰자 객체를 전달할 수 있습니다. 참고: onCompletion 콜백이 제공될 수 있지만 스냅샷 스트림은 끝이 없기 때문에 호출되지 않습니다.
setDoc(참조, 데이터)DocumentReference 에서 참조하는 문서에 씁니다. 문서가 아직 존재하지 않으면 생성됩니다.
setDoc(참조, 데이터, 옵션) 지정된 DocumentReference 에서 참조하는 문서에 씁니다. 문서가 아직 존재하지 않으면 생성됩니다. merge 또는 mergeFields 제공하면 제공된 데이터를 기존 문서에 병합할 수 있습니다.
updateDoc(참조, 데이터) 지정된 DocumentReference 에서 참조하는 문서의 필드를 업데이트합니다. 존재하지 않는 문서에 적용하면 업데이트가 실패합니다.
updateDoc(참조, 필드, 값, moreFieldsAndValues) 지정된 DocumentReference 에서 참조하는 문서의 필드를 업데이트합니다. 존재하지 않는 문서에 적용하면 업데이트가 실패합니다. 중첩된 필드는 점으로 구분된 필드 경로 문자열을 제공하거나 FieldPath 개체를 제공하여 업데이트할 수 있습니다.
기능(설정, ...)
memoryLocalCache(설정) MemoryLocalCache 인스턴스를 만듭니다. 인스턴스를 FirestoreSettings.cache 로 설정하여 사용할 캐시 계층을 SDK에 알릴 수 있습니다.
memoryLruGarbageCollector(설정) MemoryLruGarbageCollector 인스턴스를 만듭니다. 목표 크기는 설정 매개변수의 일부로 지정할 수 있습니다. 캐시 크기가 지정된 크기를 초과하면 수집기가 문서 삭제를 시작합니다. 기본 캐시 크기는 40MB(40 * 1024 * 1024바이트)입니다.
PermanentLocalCache(설정) PersistentLocalCache 인스턴스를 생성합니다. 인스턴스를 FirestoreSettings.cache 로 설정하여 사용할 캐시 계층을 SDK에 알릴 수 있습니다. Node.js 환경에서는 영구 캐시를 사용할 수 없습니다.
persistSingleTabManager(설정) PersistentSingleTabManager 의 인스턴스를 생성합니다.
기능(스냅샷, ...)
끝(스냅샷) 제공된 문서(포함)에서 끝나도록 결과 집합을 수정하는 QueryEndAtConstraint 를 만듭니다. 끝 위치는 쿼리 순서를 기준으로 합니다. 문서에는 쿼리의 orderBy에 제공된 모든 필드가 포함되어야 합니다.
endBefore(스냅샷) 제공된 문서(제외) 이전에 끝나도록 결과 집합을 수정하는 QueryEndAtConstraint 를 만듭니다. 끝 위치는 쿼리 순서를 기준으로 합니다. 문서에는 쿼리의 orderBy에 제공된 모든 필드가 포함되어야 합니다.
시작 후(스냅샷) 제공된 문서(제외) 다음에 시작되도록 결과 집합을 수정하는 QueryStartAtConstraint 를 만듭니다. 시작 위치는 쿼리 순서를 기준으로 합니다. 문서에는 쿼리의 orderBy에 제공된 모든 필드가 포함되어야 합니다.
시작 위치(스냅샷) 제공된 문서(포함)에서 시작하도록 결과 집합을 수정하는 QueryStartAtConstraint 를 만듭니다. 시작 위치는 쿼리 순서를 기준으로 합니다. 문서에는 이 쿼리의 orderBy 에 제공된 모든 필드가 포함되어야 합니다.

클래스

수업 설명
AggregateField Firestore에서 수행할 수 있는 집계를 나타냅니다.
AggregateQuery스냅샷 집계 쿼리를 실행한 결과입니다.
바이트 바이트 배열을 나타내는 변경 불가능한 객체입니다.
컬렉션참조 CollectionReference 개체는 문서 추가, 문서 참조 가져오기, 문서 쿼리( query() 사용) 에 사용할 수 있습니다. ).
문서참조 DocumentReference Firestore 데이터베이스의 문서 위치를 참조하며 위치를 쓰거나 읽거나 듣는 데 사용할 수 있습니다. 참조된 위치에 있는 문서가 존재할 수도 있고 존재하지 않을 수도 있습니다.
문서스냅샷 DocumentSnapshot 에는 Firestore 데이터베이스의 문서에서 읽은 데이터가 포함됩니다. .data() 또는 .get(<field>) 사용하여 데이터를 추출하여 특정 필드를 가져올 수 있습니다. 존재하지 않는 문서를 가리키는 DocumentSnapshot 의 경우 모든 데이터 액세스는 '정의되지 않음'을 반환합니다. exists() 메소드를 사용하여 문서의 존재를 명시적으로 확인할 수 있습니다.
필드 경로 FieldPath 는 문서의 필드를 나타냅니다. 경로는 단일 필드 이름(문서의 최상위 필드 참조) 또는 필드 이름 목록(문서의 중첩 필드 참조)으로 구성될 수 있습니다. 필드 이름을 제공하여 FieldPath 만듭니다. 둘 이상의 필드 이름이 제공되면 경로는 문서의 중첩 필드를 가리킵니다.
필드값 set() 또는 update() 로 문서 필드를 작성할 때 사용할 수 있는 Sentinel 값입니다.
소방서 Cloud Firestore 서비스 인터페이스. 이 생성자를 직접 호출하지 마세요. 대신 getFirestore()를 사용하세요. .
Firestore오류 Firestore 작업에서 반환된 오류입니다.
지오포인트 Firestore의 지리적 위치를 나타내는 변경할 수 없는 객체입니다. 위치는 위도/경도 쌍으로 표시됩니다. 위도 값의 범위는 [-90, 90]입니다. 경도 값의 범위는 [-180, 180]입니다.
LoadBundle태스크 Firestore 번들을 로드하는 작업을 나타냅니다. 번들 로딩 진행 상황은 물론 작업 완료, 오류 이벤트도 제공합니다. API는 Promise<LoadBundleTaskProgress> 와 호환됩니다.
퍼시스턴트캐시인덱스매니저 로컬 쿼리 실행에 사용되는 영구 캐시 인덱스를 구성하기 위한 PersistentCacheIndexManager 입니다. 사용하려면 getPersistentCacheIndexManager() 호출하여 인스턴스를 가져옵니다.
질문 Query 읽거나 들을 수 있는 쿼리를 의미합니다. 필터와 순서를 추가하여 세련된 Query 개체를 구성할 수도 있습니다.
쿼리복합필터제약조건 QueryCompositeFilterConstraint 는 여러 QueryFieldFilterConstraint 의 논리적 OR 또는 AND를 수행하여 Firestore 쿼리에서 반환된 문서 집합의 범위를 좁히는 데 사용됩니다. s 또는 QueryCompositeFilterConstraint 에스. QueryCompositeFilterConstraintor() 또는 and() 를 호출하여 생성된 다음 query() 에 전달되어 QueryCompositeFilterConstraint 포함하는 새 쿼리 인스턴스를 생성할 수 있습니다.
쿼리제약조건 QueryConstraint 는 Firestore 쿼리에서 반환되는 문서 집합의 범위를 좁히는 데 사용됩니다. QueryConstraintwhere()를 호출하여 생성됩니다. , 주문() , 시작 위치() , 시작 후() , 종료전() , 끝() , 한계() , limitToLast() 그리고 query() 에 전달되어 이 QueryConstraint 도 포함하는 새 쿼리 인스턴스를 만들 수 있습니다.
쿼리문서스냅샷 QueryDocumentSnapshot 에는 쿼리의 일부로 Firestore 데이터베이스의 문서에서 읽은 데이터가 포함되어 있습니다. 문서의 존재가 보장되며 해당 데이터는 .data() 또는 .get(<field>) 사용하여 추출하여 특정 필드를 얻을 수 있습니다. QueryDocumentSnapshotDocumentSnapshot 과 동일한 API 표면을 제공합니다. 쿼리 결과에는 기존 문서만 포함되므로 exists 속성은 항상 true이고 data() '정의되지 않음'을 반환하지 않습니다.
쿼리EndAt제약조건 QueryEndAtConstraint 는 Firestore 쿼리에서 반환된 결과 집합의 끝에서 문서를 제외하는 데 사용됩니다. QueryEndAtConstraintendAt() 또는 endBefore() 를 호출하여 생성된 다음 query() 에 전달되어 이 QueryEndAtConstraint 를 포함하는 새 쿼리 인스턴스를 생성할 수 있습니다.
쿼리필드필터제약조건 QueryFieldFilterConstraint 는 하나 이상의 문서 필드를 필터링하여 Firestore 쿼리에서 반환된 문서 집합의 범위를 좁히는 데 사용됩니다. QueryFieldFilterConstraintwhere() 를 호출하여 생성된 다음 query() 에 전달되어 이 QueryFieldFilterConstraint 포함하는 새 쿼리 인스턴스를 생성할 수 있습니다.
쿼리 제한 제약 QueryLimitConstraint 는 Firestore 쿼리에서 반환되는 문서 수를 제한하는 데 사용됩니다. QueryLimitConstraintlimit() 또는 limitToLast()를 호출하여 생성된 다음 query() 에 전달되어 이 QueryLimitConstraint 도 포함하는 새 쿼리 인스턴스를 생성할 수 있습니다.
쿼리OrderBy제약조건 QueryOrderByConstraint 는 Firestore 쿼리에서 반환된 문서 집합을 정렬하는 데 사용됩니다. QueryOrderByConstraintorderBy()를 호출하여 생성된 다음 query() 에 전달되어 이 QueryOrderByConstraint 도 포함하는 새 쿼리 인스턴스를 생성할 수 있습니다. 참고 : Orderby 필드가 포함되지 않은 문서는 쿼리 결과에 없습니다.
QuerySnapShot QuerySnapshot 에는 DocumentSnapshot 결과를 나타내는 객체가 0 이상이 포함되어 있습니다. 문서는 docs 속성을 통해 배열로 액세스하거나 forEach 메소드를 사용하여 열거 할 수 있습니다. 문서 수는 empty 속성 및 size 속성을 통해 결정할 수 있습니다.
QueryStartAtConstraint QueryStartAtConstraint 는 Firestore 쿼리에서 반환 된 결과 세트의 시작에서 문서를 제외하는 데 사용됩니다. QueryStartAtConstraint S는 startAt () 또는 startAfter ()를 호출하여 생성 한 다음 QueryStartAtConstraint 가 포함 된 새 Query 인스턴스를 만들려면 Query () 로 전달할 수 있습니다.
스냅샷메타데이터 스냅 샷의 상태를 설명하는 스냅 샷에 대한 메타 데이터.
타임스탬프 Timestamp UTC 에포크 시간에서 나노초 해상도에서 초의 초 및 분수로 표시되는 시간대 또는 캘린더와 무관 한 시점을 나타냅니다. Gregorian 캘린더를 1 년으로 연장하는 Proleptic Gregorian 캘린더를 사용하여 인코딩됩니다. 모든 분이 60 초 길이라고 가정하고, 즉 도약 초가 "번지"되어 해석을 위해 도약 두 번째 테이블이 필요하지 않도록 인코딩됩니다. 범위는 0001-01-01T00 : 00 : 00z ~ 9999-12-31T23 : 59 : 59.999999999z입니다. 예제 및 추가 사양은 타임 스탬프 정의를 참조하십시오. .
거래 거래에 대한 참조. Transaction 객체가 트랜잭션의 updateFunction 에 전달 된 트랜잭션 컨텍스트 내에서 데이터를 읽고 쓰는 방법을 제공합니다. runtransaction () 참조 .
쓰기배치 다중 쓰기를 단일 원자 단위로 수행하는 데 사용되는 쓰기 배치. WriteBatch 객체는 WriteBatch ()를 호출하여 얻을 수 있습니다. . 쓰기 배치에 쓰기를 추가하는 방법을 제공합니다. WriteBatch.commit ()가 호출 될 때까지 쓰기 중 어느 것도 커밋되지 않습니다 (또는 로컬로).

인터페이스

상호 작용 설명
AggregatesPec 집합 세트와 그 별칭을 지정합니다.
문서변경 DocumentChange 는 쿼리와 일치하는 문서의 변경을 나타냅니다. 영향을받는 문서와 발생한 변경 유형이 포함되어 있습니다.
DocumentData 문서 데이터 ( setDoc () 와 함께 사용 ) 값에 매핑 된 필드로 구성됩니다.
실험 폴링 옵션 긴 폴링을 사용할 때 SDK의 기본 네트워크 전송 (WebChannel)을 구성하는 옵션. 참고 :이 인터페이스는 "실험적"이며 변경 될 수 있습니다. FirestoreSettings.experimentalAutoDetectLongPolling , FirestoreSettings.experimentalForceLongPollingFirestoreSettings.experimentalLongPollingOptions 참조하십시오.
FirestoreDataConverter withConverter() 가 사용하는 변환기 유형 AppModelType 의 사용자 객체를 유형 DbModelType 의 Firestore 데이터로 변환합니다. 변환기를 사용하면 Firestore에서 객체를 저장하고 검색 할 때 일반 유형 인수를 지정할 수 있습니다. 이러한 맥락에서 "AppModel"은 관련 정보 및 기능을 함께 포장하는 데 사용되는 클래스입니다. 예를 들어, 이러한 클래스는 복잡한 중첩 된 데이터 유형, 메모 화에 사용되는 속성, Firestore에서 지원하지 않는 유형 (예 : symbolbigint ) 및 복합 작업을 수행하는 헬퍼 기능을 갖는 속성을 가질 수 있습니다. 이러한 클래스는 Firestore 데이터베이스에 저장할 수 없습니다. 대신, 그러한 클래스의 사례는 독점적으로 원시적 특성을 가진 "Plain Old JavaScript Objects"(POJO)로 변환되어야하며 잠재적으로 다른 pojos 또는 Pojos의 배열 내부에 중첩되어 있어야합니다. 이러한 맥락에서,이 유형은 "dbmodel"이라고하며 Firestore에 지속되는 대상입니다. 편의를 위해 응용 프로그램은 FirestoreDataConverter 구현하고 DocumentReference 또는 Query 와 같은 Firestore 객체와 함께 컨버터를 등록하여 Firestore에 저장할 때 AppModel 자동으로 DbModel 로 변환하고 Firestore에서 검색 할 때 DbModel AppModel 로 변환 할 수 있습니다.
Firestoresettings 클라우드 Firestore 인스턴스에 대한 사용자 정의 구성을 지정합니다. 다른 방법을 호출하기 전에이를 설정해야합니다.
색인 (베타) Firestore 지수의 SDK 정의.
인덱스 구성 (베타) 로컬 쿼리 실행 속도를 높이기위한 Firestore 인덱스 목록. 인덱스 정의 형식에 대한 설명은 JSON 형식을 참조하십시오.
인덱스 필드 (베타) 인덱스 구성의 단일 필드 요소.
LoadBundleTask진행 로딩 다발로부터 진행 상황 업데이트 또는 최종 상태를 나타냅니다.
MemoryCacheSettings MemoryLocalCache 인스턴스를 구성하려면 설정 개체.
Memory -EgergargarbageCollector 쓰레기 수집기는 활성 쿼리의 일부가 아닐 때마다 문서를 삭제하며 국소 돌연변이가 부착되어 있지 않습니다. 이 수집기는 오프라인 쿼리 또는 캐시에 대한 직접 쿼리를 위해 문서가 캐시되지 않을 위험에 따라 SDK에서 가장 낮은 메모리 발자국을 보장하려고합니다. 공장 기능을 사용 하여이 수집기의 인스턴스를 만듭니다.
MemoryLocalCache SDK에 메모리 캐시를 제공합니다. 명시 적으로 달리 명시하지 않는 한 기본 캐시입니다. 사용하려면 Factory 함수를 사용하여 인스턴스를 작성한 다음 인스턴스를 FirestoreSettings.cache 로 설정하고 설정 객체를 사용하여 initializeFirestore 를 호출하십시오.
MemoryLrugarbageCollector 쓰레기 수집기는 최소한의 문서를 여러 배치로 삭제합니다. 이 수집기는 대상 크기로 구성되며 캐시 된 문서가 대상 크기를 초과 할 때만 컬렉션을 수행합니다. 메모리 발자국이 더 큰 경우 동일한 쿼리 나 문서에 대해 쿼리 백엔드가 반복되는 것을 피합니다. 공장 기능을 사용 하여이 수집기의 인스턴스를 만듭니다.
지속성 세팅 FireStore 지속성을 구성하기 위해 enableIndexedDbPersistence() 로 전달할 수있는 설정. Node.js 환경에서 지속성을 사용할 수 없습니다.
persistentCachesettings settings 객체는 PersistentLocalCache 인스턴스를 구성합니다. Node.js 환경에서 영구 캐시를 사용할 수 없습니다.
persistentlocalcache IndexedDB가 SDK에 뒷받침하는 지속적인 캐시를 제공합니다. 사용하려면 Factory 함수를 사용하여 인스턴스를 작성한 다음 인스턴스를 FirestoreSettings.cache 로 설정하고 설정 객체를 사용하여 initializeFirestore 를 호출하십시오.
PersistentMultipletabManager 여러 탭을 지원하는 탭 관리자. SDK는 SDK를 사용하여 모든 탭에서 수행 된 쿼리 및 돌연변이를 동기화합니다.
Persistentsingingletabmanager 하나의 탭 만 지원하는 탭 관리자는 탭에서 동기화가 수행되지 않습니다.
Peristentsingletabmanagersettings 유형을 구성하려면 PersistentSingleTabManager 인스턴스를 구성하십시오.
스냅샷 듣기 옵션 결과 세트에 포함 할 변경 유형을 제어하기 위해 onsnapShot ()QuerySnapShot.DocChanges () 로 전달할 수있는 옵션 개체.
스냅샷 옵션 DocumentSnapshot 에서 데이터를 검색하는 방법을 구성하는 옵션 (예 : 아직 최종 값으로 설정되지 않은 서버 타임 스탬프의 원하는 동작).
TransactionOptions 거래 동작을 사용자 정의하는 옵션.
구독 취소 onSnapshot() 에 의해 반환 된 함수는 호출 할 때 리스너를 제거합니다.

변수

변하기 쉬운 설명
cache_size_unlimited LRU 쓰레기 수집을 나타내는 데 사용되는 상수는 비활성화되어야합니다. 이 값을 Firestore 인스턴스로 전달한 설정의 cacheSizeBytes 로 설정하십시오.

별명을 입력하십시오

유형 별명 설명
AddPrefixtokeys 모든 키가 점에 추가 된 외부 키로 접두사가있는 새 맵을 반환합니다.
AggregateFieldType Firestore가 지원하는 모든 AggregateField 유형의 결합.
AggregatesPecData 키가 AggregateSpec 에서 가져온 유형과 입력 AggregateSpec 에서 해당 AggregateField 에 의해 수행 된 응집의 결과 인 값은 값입니다.
AGGREGATETYPE 수행 할 골재 유형을 나타내는 통합 유형.
childupdatefields 주어진 유형 T1의 중첩 필드를 계산하기위한 도우미. 이것은 undefined | {...} (선택적 소품의 경우 발생) 또는 {a: A} | {b: B} . 이 사용 사례에서, V 표현으로 평가되고 분포되지 않기 때문에 V는 Record t [ T[K] T[K] 의 노조 유형을 분배하는데 사용된다. https://www.typescriptlang.org/docs/handbook/advanced-types.html#distrive-conditional-types를 참조하십시오
DocumentChangeType DocumentChange 의 유형은 '추가', '제거'또는 '수정'될 수 있습니다.
FirestoreErrorCode Firestore 상태 코드 세트. 코드는 grpc에 노출 된 코드와 동일합니다. 가능한 값 : - '취소': 작업이 취소되었습니다 (일반적으로 발신자가). - '알 수없는': 알려지지 않은 오류 또는 다른 오류 도메인의 오류. - '유효하지 않은 연계': 클라이언트는 잘못된 인수를 지정했습니다. 이는 '실패한 정화'와 다릅니다. '유효하지 않음'은 시스템 상태에 관계없이 문제가되는 인수를 나타냅니다 (예 : 잘못된 필드 이름). - 'Deadline-Exceed': 작업이 완료되기 전에 마감일이 만료되었습니다. 시스템 상태를 변경하는 작업의 경우 작업이 성공적으로 완료된 경우 에도이 오류가 반환 될 수 있습니다. 예를 들어, 서버의 성공적인 응답은 마감일이 만료 될 정도로 오래 지연 될 수 있습니다. - '전혀 발견되지 않았다': 일부 요청 된 문서는 찾을 수 없었습니다. - '이미 존재하는 것': 우리가 만들려고 시도한 일부 문서는 이미 존재합니다. - '허가 부인': 발신자는 지정된 작업을 실행할 권한이 없습니다. -'Resource-Exhausted': 일부 리소스가 소진되었으며, 아마도 사용자 당 할당량이 있거나 아마도 전체 파일 시스템이 공간 이외의 것일 수 있습니다. - '실패- 절도': 시스템이 작업 실행에 필요한 상태에 있지 않기 때문에 작동이 거부되었습니다. - '중단': 일반적으로 트랜잭션 중단 등과 같은 동시 문제로 인해 작업이 중단되었습니다.- '범위 외': 작업은 유효한 범위를 지나서 시도되었습니다. - 'Unimplemented': 작동이 구현되지 않았거나 지원/활성화되지 않습니다. - '내부': 내부 오류. 기본 시스템에서 예상되는 일부 불변량이 파손되었음을 의미합니다. 이러한 오류 중 하나가 보이면 무언가가 매우 깨졌습니다. - '사용할 수 없음': 현재 서비스를 사용할 수 없습니다. 이것은 아마도 일시적인 조건 일 가능성이 높으며 백 오프로 다시 시도하여 수정 될 수 있습니다. - 'Data-Loss': 복귀 할 수없는 데이터 손실 또는 손상. - 'Unuthenticated': 요청에는 작업에 대한 유효한 인증 자격 증명이 없습니다.
Firestorelocalcache 모든 지원되는 SDK 캐시 계층의 Union 유형.
ErenenSource 쿼리가 듣는 소스를 설명하십시오. 캐시 및 서버 변경 사항을 모두 듣기 위해 default 으로 설정하십시오. cache 로 설정하여 캐시의 변경 사항을 듣습니다.
MemoryGargageCollector 메모리 로컬 캐시에 대한 모든 지원 Gabage Collector의 Union 유형.
NestEdupdatefields 각 필드 (예 : 'bar')마다 중첩 된 키를 모두 찾으십시오 (예 : { 'bar.baz': t1, 'bar.qux': t2 } ). 옵션으로 표시되는 모든 가능한 키를 포함하는 단일 맵을 만들기 위해 서로 교차합니다.
주문 방향 orderby () 절의 방향은 'desc'또는 'asc'(하강 또는 오름차순)로 지정됩니다.
부분적으로 fieldValue TypeScript의 Partial<T> 와 유사하지만 중첩 필드를 생략하고 속성 값으로 전달할 수 있습니다.
PersistentTabmanager 사용 가능한 모든 탭 관리자의 통합.
원어 원시 유형.
QueryConstraintType 이 SDK에서 사용 가능한 다른 쿼리 제약 조건을 설명합니다.
QueryFilterConstraint QueryFilterConstraint .
QueryNonFilterConstraint QueryNonFilterConstraint 문서 세트를 좁히거나 주문하는 데 사용되는 QueryConstraints를 나타내는 도우미 노조 유형입니다. QueryNonFilterConstraint S는 Orderby ()를 호출하여 생성됩니다. , startat () , startAfter () , Endbey Prore () , endat () , limit () 또는 limittoLast ()를 다음 QueryConstraint 포함하는 새 쿼리 인스턴스를 생성하기 위해 Query () 로 전달할 수 있습니다.
옵션 설정 setDoc () 의 동작을 구성하는 옵션 객체 및 전화. 이러한 통화는 merge: true 와 함께 SetOptions 제공하여 대상 문서를 전체적으로 덮어 쓰는 대신 입상 병합을 수행하도록 구성 할 수 있습니다.
작업 상태 번들로드 작업 상태를 나타냅니다. '오류'와 '성공'은 모두 가라 앉는 상태입니다. 작업은 중단되거나 완료되며보고 된 후에는 더 이상 업데이트가 없습니다.
Uniontointersection Union Type U = T1 | T2 | ... , 교차 유형 (T1 & T2 & ...) 을 반환합니다. 분배 조건부 유형 및 조건부 유형의 추론을 사용합니다. 이는 반영 변수 위치에서 동일한 유형 변수에 대한 여러 후보자가 교차 유형을 추론하기 때문에 작동합니다. https://www.typescriptlang.org/docs/handbook/advanced-types.html#tempe-inference-in-conditional-types https://stackoverflow.com/questions/50374908/transform-union-type-tintersection -유형
업데이트 데이터 업데이트 ( 업데이트 와 함께 사용 )는 필드 경로 (예 : 'foo'또는 'foo.baz')로 구성됩니다. 도트를 포함하는 필드는 문서 내에서 중첩 된 필드를 참조합니다. FieldValues는 속성 값으로 전달할 수 있습니다.
Wherefilterop Where () 조항의 필터 조건은 문자열 '& lt;', '& lt; =', '= =', '! =', '& gt; =', '& gt;', 'Array-Contains'를 사용하여 지정됩니다. , 'in', 'array-contains-any'및 'not-in'.
WithfieldValue 유형 안전을 유지하면서 FieldValues를 속성 값으로 전달할 수 있습니다.

기능 (앱, ...)

getfirestore (앱)

제공된 FireBaseapp 와 관련된 기존 기본 Firestore 인스턴스를 반환합니다. . 인스턴스가없는 경우 기본 설정으로 새 인스턴스를 초기화합니다.

서명:

export declare function getFirestore(app: FirebaseApp): Firestore;

매개변수

매개변수 유형 설명
Firebase앱 반환 된 FireStore 인스턴스가 연관된 FireBaseApp 인스턴스.

보고:

소방서

제공된 앱의 기본 FIRESTORE 인스턴스.

getFirestore (앱, 데이터베이스)

이 API는 개발자를위한 미리보기로 제공되며 우리가받는 피드백에 따라 변경 될 수 있습니다. 생산 환경 에서이 API를 사용하지 마십시오.

제공된 FireBaseapp 와 관련된 기존 이름이 지정된 Firestore 인스턴스를 반환합니다. . 인스턴스가없는 경우 기본 설정으로 새 인스턴스를 초기화합니다.

서명:

export declare function getFirestore(app: FirebaseApp, databaseId: string): Firestore;

매개변수

매개변수 유형 설명
Firebase앱 반환 된 FireStore 인스턴스가 연관된 FireBaseApp 인스턴스.
Databaseid 데이터베이스 이름.

보고:

소방서

제공된 앱의 명명 된 Firestore 인스턴스.

InitializeFirestore (앱, 설정, DatabaseId)

제공된 설정으로 새로운 Firestore 인스턴스를 초기화합니다. getFirestore ()를 포함하여 다른 기능보다 먼저 호출 할 수 있습니다. . 사용자 정의 설정이 비어 있으면이 기능은 getFirestore () 호출하는 것과 같습니다. .

서명:

export declare function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings, databaseId?: string): Firestore;

매개변수

매개변수 유형 설명
Firebase앱 Firestore 인스턴스가 연결된 FireBaseApp .
설정 Firestoresettings Firestore 인스턴스를 구성하려면 설정 객체.
Databaseid 데이터베이스 이름.

보고:

소방서

새로 초기화 된 Firestore 인스턴스.

기능 (Firestore, ...)

CLEARINDEDEDDBPERISTENCE (FIRESTORE)

영구 저장소를 지 웁니다. 여기에는 보류중인 쓰기 및 캐시 된 문서가 포함됩니다.

Firestore 인스턴스가 시작되지 않은 상태에서 호출해야합니다 (앱이 종료 된 후 또는 앱이 처음 초기화 된 시점). 시작 시이 함수는 다른 기능 ( InteatizeFirestore () 또는 getFirestore () 를 제외하고 호출해야합니다. )). Firestore 인스턴스가 여전히 실행중인 경우 failed-precondition 오류 코드로 약속이 거부됩니다. .

서명:

export declare function clearIndexedDbPersistence(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서 지속성을 제거하기위한 Firestore 인스턴스.

보고:

약속 <void>

영구 스토리지가 제거 될 때 해결되는 Promise . 그렇지 않으면 약속이 오류로 거부됩니다.

수집 (Firestore, Path, Pathsegments)

지정된 절대 경로에서 컬렉션을 나타내는 CollectionReference 인스턴스를 가져옵니다.

서명:

export declare function collection(firestore: Firestore, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
소방서 소방서 루트 Firestore 인스턴스에 대한 참조.
컬렉션으로가는 슬래시로 구분 된 경로.
PARSSEGMENTS 끈[] 첫 번째 인수와 관련하여 적용 할 추가 경로 세그먼트.

보고:

CollectionReference < documentData , DocumentData >

CollectionReference 인스턴스.

예외

최종 경로에 균일 한 세그먼트가 있고 컬렉션을 가리키지 않는 경우.

CollectionGroup (Firestore, CollectionId)

주어진 collectionId 와의 수집 또는 하위 수집에 포함 된 데이터베이스에 모든 문서가 포함 된 새 Query 인스턴스를 생성하고 반환합니다. .

서명:

export declare function collectionGroup(firestore: Firestore, collectionId: string): Query<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
소방서 소방서 루트 Firestore 인스턴스에 대한 참조.
CollectionId 쿼리 할 컬렉션을 식별합니다. 경로의 마지막 세그먼트 로서이 ID를 사용한 모든 수집 또는 하위 수집이 포함됩니다. 슬래시를 포함 할 수 없습니다.

보고:

질문 < documentData , DocumentData >

생성 된 Query .

ConnectFirestoreEmulator (Firestore, 호스트, 포트, 옵션)

클라우드 파이어 스토어 에뮬레이터와 통신하려면이 인스턴스를 수정하십시오.

서명:

export declare function connectFirestoreEmulator(firestore: Firestore, host: string, port: number, options?: {
    mockUserToken?: EmulatorMockTokenOptions | string;
}): void;

매개변수

매개변수 유형 설명
소방서 소방서 에뮬레이터에 연결하도록 구성 할 Firestore 인스턴스.
주인 에뮬레이터 호스트 (예 : LocalHost).
포트 숫자 에뮬레이터 포트 (예 : 9000).
옵션 {mockusertoken? : Emulatormocktokenoptions | 끈; }

보고:

무효의

DisablenEtwork (Firestore)

이 인스턴스의 네트워크 사용을 비활성화합니다. enableNetwork ()를 통해 다시 활성화 할 수 있습니다. . 네트워크가 비활성화되는 동안 모든 스냅 샷 리스너, getDoc() 또는 getDocs() 호출은 캐시에서 결과를 반환하고 네트워크가 복원 될 때까지 쓰기 작업이 대기됩니다.

서명:

export declare function disableNetwork(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

약속 <void>

네트워크가 비활성화되면 해결되는 Promise .

DOC (Firestore, Path, Pathsegments)

지정된 절대 경로에서 문서를 나타내는 DocumentReference 인스턴스를 가져옵니다.

서명:

export declare function doc(firestore: Firestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
소방서 소방서 루트 Firestore 인스턴스에 대한 참조.
문서로의 슬래시로 구분 된 경로.
PARSSEGMENTS 끈[] 첫 번째 인수에 비해 적용될 추가 경로 세그먼트.

보고:

DocumentReference < documentData , DocumentData >

DocumentReference 인스턴스.

예외

최종 경로에 홀수 세그먼트가 있고 문서를 가리키지 않는 경우.

enableIndexEddBpersistence (Firestore, PersistenceSettings)

이 기능은 향후 주요 릴리스에서 제거됩니다. 대신 FirestoreSettings.localCache PersistentLocalCache 인스턴스로 설정하여 IndexedDB 캐시를 켜십시오. FirestoreSettings.localCache 이미 지정된 경우이 기능을 호출하면 예외가 발생합니다.

가능하면 지속적인 스토리지를 활성화하려고 시도합니다.

실패시 enableIndexedDbPersistence() 약속을 거부하거나 예외를 던집니다. 이것이 실패 할 수있는 이유는 몇 가지가 있으며, 이는 오류의 code 로 식별 할 수 있습니다.

* 실패 : 앱은 이미 다른 브라우저 탭에서 열려 있습니다. * 구현되지 않은 : 브라우저는 오프라인 지속성 구현과 호환되지 않습니다.

실패 후에도 Firestore 인스턴스는 사용할 수 있지만 오프라인 지속성은 비활성화됩니다.

Node.js 환경에서 지속성을 사용할 수 없습니다.

서명:

export declare function enableIndexedDbPersistence(firestore: Firestore, persistenceSettings?: PersistenceSettings): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서 지속성을 활성화하기위한 Firestore 인스턴스.
지속성 세팅 지속성 세팅 옵션 설정 개체 끈기를 구성합니다.

보고:

약속 <void>

지속적인 스토리지를 성공적으로 가능하게하는 Promise .

enablemultitabindexeddbpersistence (Firestore)

이 기능은 향후 주요 릴리스에서 제거됩니다. 대신 FirestoreSettings.localCache PersistentLocalCache 인스턴스로 설정하여 IndexedDB 캐시를 켜십시오. FirestoreSettings.localCache 이미 지정된 경우이 기능을 호출하면 예외가 발생합니다.

가능하면 멀티 탭 영구 저장소를 활성화하려고 시도합니다. 모든 탭에서 활성화 된 경우 모든 작업은 모든 연결된 인스턴스에서 쿼리의 공유 실행 및 대기 시간 보상 로컬 문서 업데이트를 포함하여 로컬 지속성에 대한 액세스를 공유합니다.

실패시 enableMultiTabIndexedDbPersistence() 약속을 거부하거나 예외를 던집니다. 이것이 실패 할 수있는 이유는 몇 가지가 있으며, 이는 오류의 code 로 식별 할 수 있습니다.

* 실패 : 앱은 이미 다른 브라우저 탭에서 열려 있으며 멀티 탭이 활성화되지 않았습니다. * 구현되지 않은 : 브라우저는 오프라인 지속성 구현과 호환되지 않습니다.

실패 후에도 Firestore 인스턴스는 사용할 수 있지만 오프라인 지속성은 비활성화됩니다.

서명:

export declare function enableMultiTabIndexedDbPersistence(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서 지속성을 활성화하기위한 Firestore 인스턴스.

보고:

약속 <void>

지속적인 스토리지를 성공적으로 가능하게하는 Promise .

enableNetwork (Firestore)

disablenetwork () 에 대한 사전 호출 후이 Firestore 인스턴스에 네트워크 사용을 다시 제출하십시오. .

서명:

export declare function enableNetwork(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

약속 <void>

네트워크가 활성화되면 해결되는 Promise .

getPersistentCacheIndexManager (Firestore)

주어진 Firestore 객체에서 사용하는 PersistentCache Index Manager를 반환합니다.

PersistentCacheIndexManager 인스턴스 또는 로컬 영구 스토리지가 사용되지 않는 경우 null .

서명:

export declare function getPersistentCacheIndexManager(firestore: Firestore): PersistentCacheIndexManager | null;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

persistentCacheIndexManager | 없는

LoadBundle (Firestore, Bundledata)

Firestore 번들을 로컬 캐시에로드합니다.

서명:

export declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask;

매개변수

매개변수 유형 설명
소방서 소방서 번들을로드 할 Firestore 인스턴스.
Bundledata readableStream <UINT8ARRAY> | 배열버퍼 | 끈 로드 할 번들을 나타내는 물체. 유효한 개체는 ArrayBuffer , ReadableStream<Uint8Array> 또는 string 입니다.

보고:

LoadBundle태스크

LoadBundleTask 객체는 발신자에게 진행 상황 업데이트 및 완료 또는 오류 이벤트를 알립니다. Promise<LoadBundleTaskProgress> 로 사용할 수 있습니다. .

명명 된 query (Firestore, Name)

주어진 이름으로 식별 된 로컬 캐시에서 Firestore 쿼리를 읽습니다.

명명 된 쿼리는 서버 측의 번들로 패키지 (결과 문서와 함께)로 loadBundle 을 사용하여 로컬 캐시에로드됩니다. . 로컬 캐시에 들어가면이 방법을 사용하여 이름별로 쿼리를 추출하십시오.

서명:

export declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;

매개변수

매개변수 유형 설명
소방서 소방서 쿼리를 읽는 Firestore 인스턴스.
이름 쿼리의 이름.

보고:

약속 < 쿼리 | null>

쿼리 또는 null 로 해결되는 Promise .

onsnapshotsinsync (Firestore, Observer)

Snapshots-in-Sync 이벤트에 대한 리스너를 첨부합니다. Snapshots-in-Sync 이벤트는 단일 서버 생성 변경이 여러 리스너에게 영향을 미치더라도 주어진 변경에 영향을받는 모든 청취자가 발사되었음을 나타냅니다.

참고 : Snapshots-in-Sync 이벤트는 리스너가 서로 동기화되어 있음을 나타내지 만 해당 스냅 샷이 서버와 동기화되어 있는지 여부와 관련이 없습니다. 개별 리스너에서 SnapshotMetadata를 사용하여 스냅 샷이 캐시 또는 서버에서 나온지 확인하십시오.

서명:

export declare function onSnapshotsInSync(firestore: Firestore, observer: {
    next?: (value: void) => void;
    error?: (error: FirestoreError) => void;
    complete?: () => void;
}): Unsubscribe;

매개변수

매개변수 유형 설명
소방서 소방서 스냅 샷 동기화를위한 Firestore 인스턴스.
관찰자 {다음? : (value : void) => void; 오류? : (오류 : Firestoreerror ) => void; 완료? : () => void; } nexterror 콜백을 포함하는 단일 객체.

보고:

구독 취소

스냅 샷 리스너를 취소하기 위해 호출 할 수있는 구독 취소 기능.

onsnapshotsinsync (Firestore, onsync)

Snapshots-in-Sync 이벤트에 대한 리스너를 첨부합니다. Snapshots-in-Sync 이벤트는 단일 서버 생성 변경이 여러 리스너에게 영향을 미치더라도 주어진 변경에 영향을받는 모든 청취자가 발사되었음을 나타냅니다.

참고 : Snapshots-in-Sync 이벤트는 리스너가 서로 동기화되어 있음을 나타내지 만 해당 스냅 샷이 서버와 동기화되어 있는지 여부와 관련이 없습니다. 개별 리스너에서 SnapshotMetadata 사용하여 스냅 샷이 캐시 또는 서버에서 나온지 확인하십시오.

서명:

export declare function onSnapshotsInSync(firestore: Firestore, onSync: () => void): Unsubscribe;

매개변수

매개변수 유형 설명
소방서 소방서 스냅 샷 동기화를위한 Firestore 인스턴스.
onsync () => void 모든 스냅 샷 리스너가 서로 동기화 될 때마다 호출되는 콜백.

보고:

구독 취소

스냅 샷 리스너를 취소하기 위해 호출 할 수있는 구독 취소 기능.

Runtransaction (Firestore, UpdateFunction, 옵션)

주어진 updateFunction 실행 한 다음 트랜잭션 내에 적용된 변경 사항을 커밋하려고 시도합니다. updateFunction 내에서 읽은 문서가 변경되면 Cloud Firestore . 5 번의 시도 후 커밋되지 않으면 거래가 실패합니다.

단일 거래에서 허용되는 최대 쓰기 수는 500입니다.

서명:

export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;

매개변수

매개변수 유형 설명
소방서 소방서 이 트랜잭션을 실행하기 위해 Firestore 데이터베이스에 대한 참조.
업데이트 기능 (거래 : 거래 ) => 약속 <t> 트랜잭션 컨텍스트 내에서 실행할 함수.
옵션 TransactionOptions 커밋하려는 최대 시도 수를 구성하는 옵션 개체.

보고:

약속 <t>

트랜잭션이 성공적으로 완료되었거나 명시 적으로 중단 된 경우 ( updateFunction 실패한 약속을 반환) updateFunction 에 의해 반환 된 약속 여기에 반환됩니다. 그렇지 않으면 거래에 실패하면 해당 실패 오류에 대한 거부 된 약속이 반환됩니다.

setIndexConfiguration (Firestore, 구성)

이 API는 개발자를위한 미리보기로 제공되며 우리가받는 피드백에 따라 변경 될 수 있습니다. 생산 환경 에서이 API를 사용하지 마십시오.

캐시 인덱스를 수동으로 생성하는 대신 enablePersistentCacheIndexAutoCreation() 사용하여 SDK가 로컬로 실행되는 쿼리의 캐시 인덱스를 생성할지 여부를 결정할 수 있습니다.

로컬 쿼리 실행에 대한 인덱싱을 구성합니다. 이전 인덱스 구성이 재정의됩니다. 인덱스 구성이 지속되면 Promise 해결됩니다.

인덱스 항목 자체는 비동기 적으로 생성됩니다. 인덱스를 아직 사용할 수없는 경우에도 인덱싱이 필요한 쿼리를 계속 사용할 수 있습니다. 인덱스 항목이 작성되면 쿼리 실행이 인덱스를 사용하여 자동으로 시작됩니다.

인덱스는 indexedDB 지속성으로 만 지원됩니다. indexedDB가 활성화되지 않은 경우 인덱스 구성이 무시됩니다.

서명:

export declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서 인덱스를 구성하려는 Firestore 인스턴스.
구성 인덱스 구성 색인 정의.

보고:

약속 <void>

모든 지수가 성공적으로 구성되면 해결되는 Promise .

예외

Firestoreerror JSON 형식이 유효하지 않은 경우.

setIndexConfiguration (Firestore, JSON)

이 API는 개발자를위한 미리보기로 제공되며 우리가받는 피드백에 따라 변경 될 수 있습니다. 생산 환경 에서이 API를 사용하지 마십시오.

캐시 인덱스를 수동으로 생성하는 대신 enablePersistentCacheIndexAutoCreation() 사용하여 SDK가 로컬로 실행되는 쿼리의 캐시 인덱스를 생성할지 여부를 결정할 수 있습니다.

로컬 쿼리 실행에 대한 인덱싱을 구성합니다. 이전 인덱스 구성이 재정의됩니다. 인덱스 구성이 지속되면 Promise 해결됩니다.

인덱스 항목 자체는 비동기 적으로 생성됩니다. 인덱스를 아직 사용할 수없는 경우에도 인덱싱이 필요한 쿼리를 계속 사용할 수 있습니다. 인덱스 항목이 작성되면 쿼리 실행이 인덱스를 사용하여 자동으로 시작됩니다.

인덱스는 indexedDB 지속성으로 만 지원됩니다. 인덱스 구성을 설정하기 전에 enableIndexedDbPersistence() 또는 enableMultiTabIndexedDbPersistence() 호출하십시오. indexedDB가 활성화되지 않은 경우 인덱스 구성이 무시됩니다.

이 방법은 Firebase CLI ( firebase firestore:indexes 에 의해 내보낸 JSON 형식을 허용합니다. ). JSON 형식이 유효하지 않으면이 메소드가 오류가 발생합니다.

서명:

export declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서 인덱스를 구성하려는 Firestore 인스턴스.
JSON Firebase CLI에 의해 내보낸 JSON 형식.

보고:

약속 <void>

모든 지수가 성공적으로 구성되면 해결되는 Promise .

예외

Firestoreerror JSON 형식이 유효하지 않은 경우.

종료 (Firestore)

제공된 FireStore 인스턴스를 종료합니다.

terminate() 호출 후 clearIndexedDbPersistence() 함수 만 사용될 수 있습니다. 다른 기능은 FirestoreError 던집니다 .

종료 후 다시 시작하려면 getFirestore () 로 FireBaseFirestore의 새 인스턴스를 만듭니다. .

종료는 보류중인 글을 취소하지 않으며 서버에서 응답을 기다리는 약속은 해결되지 않습니다. 지속성이 활성화되면 다음 에이 인스턴스를 시작할 때이 쓰기를 서버로 보내는 것이 재개됩니다.

서명:

export declare function terminate(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

약속 <void>

인스턴스가 성공적으로 종료되었을 때 해결되는 Promise .

WaitforPendingwrites (Firestore)

활성 사용자에 대한 현재 보류중인 모든 글이 백엔드에 의해 인정 될 때까지 기다립니다.

뛰어난 약속은 뛰어난 글이 없으면 즉시 해결됩니다. 그렇지 않으면, 약속은 이전에 발행 된 모든 쓰기 (이전 앱 세션에 작성된 내용 포함)를 기다립니다. 그러나 함수가 호출 된 후 추가 된 글을 기다리지 않습니다. 추가 쓰기를 기다리려면 waitForPendingWrites() 다시 전화하십시오.

사용자 변경 중에 미결제 waitForPendingWrites() 약속이 거부됩니다.

서명:

export declare function waitForPendingWrites(firestore: Firestore): Promise<void>;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

약속 <void>

현재 계류중인 모든 글이 백엔드에 의해 인정되었을 때 해결되는 Promise .

WriteBatch (Firestore)

단일 원자 연산으로 다중 쓰기를 수행하는 데 사용되는 쓰기 배치를 만듭니다. 단일 쓰기 배치 에서 허용되는 최대 쓰기 수는 500입니다.

트랜잭션과 달리, 쓰기 배치는 오프라인으로 유지되므로 읽기 데이터에 대한 쓰기를 조정할 필요가 없을 때 바람직합니다.

서명:

export declare function writeBatch(firestore: Firestore): WriteBatch;

매개변수

매개변수 유형 설명
소방서 소방서

보고:

쓰기배치

다중 쓰기를 원자 적으로 실행하는 데 사용할 수있는 WriteBatch .

기능()

세다()

쿼리 결과 세트에서 문서 수를 계산하는 데 사용할 수있는 AggregateField 객체를 만듭니다.

서명:

export declare function count(): AggregateField<number>;

보고:

골재 필드 <번호>

deletefield ()

{merge: true} 필드를 표시하려면 updateoc () 또는 setDoc () 와 함께 사용할 수있는 센티넬을 반환합니다.

서명:

export declare function deleteField(): FieldValue;

보고:

필드값

DocumentID ()

문서의 ID를 참조하기 위해 특별한 센티넬 FieldPath 반환합니다. 문서 ID로 정렬하거나 필터링하는 데 쿼리로 사용할 수 있습니다.

서명:

export declare function documentId(): FieldPath;

보고:

FieldPath

getfirestore ()

기본 FireBaseapp 와 관련된 기존 기본 Firestore 인스턴스를 반환합니다. . 인스턴스가없는 경우 기본 설정으로 새 인스턴스를 초기화합니다.

서명:

export declare function getFirestore(): Firestore;

보고:

소방서

기본 앱의 기본 Firestore 인스턴스.

MemoryeaggargageCollector ()

MemoryEagerGarbageCollector 인스턴스를 만듭니다 . 이것은 또한 달리 명시 적으로 지정되지 않는 한 기본 쓰레기 수집기이기도합니다.

서명:

export declare function memoryEagerGarbageCollector(): MemoryEagerGarbageCollector;

보고:

Memory -EgergargarbageCollector

PersistentMultipletabManager ()

PersistentMultipleTabManager 인스턴스를 만듭니다 .

서명:

export declare function persistentMultipleTabManager(): PersistentMultipleTabManager;

보고:

PersistentMultipletabManager

servertimestamp ()

서면 데이터에 서버 생성 타임 스탬프를 포함시키기 위해 setDoc () 또는 updatedoc () 와 함께 사용 된 센티넬을 반환합니다.

서명:

export declare function serverTimestamp(): FieldValue;

보고:

필드값

기능 (Databaseid, ...)

GetFirestore (DatabaseId)

이 API는 개발자를위한 미리보기로 제공되며 우리가받는 피드백에 따라 변경 될 수 있습니다. 생산 환경 에서이 API를 사용하지 마십시오.

기본 FireBaseapp 와 관련된 기존 이름이 지정된 Firestore 인스턴스를 반환합니다. . 인스턴스가없는 경우 기본 설정으로 새 인스턴스를 초기화합니다.

서명:

export declare function getFirestore(databaseId: string): Firestore;

매개변수

매개변수 유형 설명
Databaseid 데이터베이스 이름.

보고:

소방서

기본 앱의 명명 된 Firestore 인스턴스.

함수 (요소, ...)

Arrayremove (요소)

setDoc () 와 함께 사용할 수있는 특수 값을 반환하거나 서버에 서버에 이미 존재하는 배열 값에서 주어진 요소를 제거하도록 지시합니다. 지정된 각 요소의 모든 인스턴스는 배열에서 제거됩니다. 수정중인 필드가 아직 배열이 아닌 경우 빈 배열로 덮어 씁니다.

서명:

export declare function arrayRemove(...elements: unknown[]): FieldValue;

매개변수

매개변수 유형 설명
강요 알려지지 않은[] 배열에서 제거 할 요소.

보고:

필드값

setDoc() 또는 updateDoc() 에 대한 호출에 사용하기위한 FieldValue Sentinel

배열 (요소)

SetDoc () 또는 updatedoc () 와 함께 사용할 수있는 특수 값을 반환하여 서버에 서버에 이미 존재하는 배열 값으로 주어진 요소를 유니너로 알려줍니다. 배열에 아직 존재하지 않는 지정된 요소는 끝에 추가됩니다. 수정중인 필드가 이미 배열이 아닌 경우 지정된 요소가 포함 된 배열로 덮어 씁니다.

서명:

export declare function arrayUnion(...elements: unknown[]): FieldValue;

매개변수

매개변수 유형 설명
강요 알려지지 않은[] The elements to union into the array.

보고:

필드값

The FieldValue sentinel for use in a call to setDoc() or updateDoc() .

function(field, ...)

average(field)

Create an AggregateField object that can be used to compute the average of a specified field over a range of documents in the result set of a query.

서명:

export declare function average(field: string | FieldPath): AggregateField<number | null>;

매개변수

매개변수 유형 설명
필드 문자열 | FieldPath Specifies the field to average across the result set.

보고:

AggregateField <number | null>

sum(field)

Create an AggregateField object that can be used to compute the sum of a specified field over a range of documents in the result set of a query.

서명:

export declare function sum(field: string | FieldPath): AggregateField<number>;

매개변수

매개변수 유형 설명
필드 문자열 | FieldPath Specifies the field to sum across the result set.

보고:

AggregateField <number>

function(fieldPath, ...)

orderBy(fieldPath, directionStr)

Creates a QueryOrderByConstraint that sorts the query result by the specified field, optionally in descending order instead of ascending.

서명:

export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;

매개변수

매개변수 유형 설명
fieldPath 문자열 | FieldPath The field to sort by.
directionStr OrderByDirection Optional direction to sort by ('asc' or 'desc'). If not specified, order will be ascending.

보고:

QueryOrderByConstraint

The created QueryOrderByConstraint .

where(fieldPath, opStr, value)

Creates a QueryFieldFilterConstraint that enforces that documents must contain the specified field and that the value should satisfy the relation constraint provided.

서명:

export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;

매개변수

매개변수 유형 설명
fieldPath 문자열 | FieldPath The path to compare
opStr WhereFilterOp The operation string (eg "&lt;", "&lt;=", "==", "&lt;", "&lt;=", "!=").
알려지지 않은 The value for comparison

보고:

QueryFieldFilterConstraint

The created QueryFieldFilterConstraint .

function(fieldValues, ...)

endAt(fieldValues)

Creates a QueryEndAtConstraint that modifies the result set to end at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

서명:

export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;

매개변수

매개변수 유형 설명
fieldValues 알려지지 않은[] The field values to end this query at, in order of the query's order by.

보고:

QueryEndAtConstraint

A QueryEndAtConstraint to pass to query()

endBefore(fieldValues)

Creates a QueryEndAtConstraint that modifies the result set to end before the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

서명:

export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;

매개변수

매개변수 유형 설명
fieldValues 알려지지 않은[] The field values to end this query before, in order of the query's order by.

보고:

QueryEndAtConstraint

A QueryEndAtConstraint to pass to query()

startAfter(fieldValues)

Creates a QueryStartAtConstraint that modifies the result set to start after the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

서명:

export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;

매개변수

매개변수 유형 설명
fieldValues 알려지지 않은[] The field values to start this query after, in order of the query's order by.

보고:

QueryStartAtConstraint

A QueryStartAtConstraint to pass to query()

startAt(fieldValues)

Creates a QueryStartAtConstraint that modifies the result set to start at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query.

서명:

export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;

매개변수

매개변수 유형 설명
fieldValues 알려지지 않은[] The field values to start this query at, in order of the query's order by.

보고:

QueryStartAtConstraint

A QueryStartAtConstraint to pass to query() .

function(indexManager, ...)

deleteAllPersistentCacheIndexes(indexManager)

Removes all persistent cache indexes.

Please note this function will also deletes indexes generated by setIndexConfiguration() , which is deprecated.

서명:

export declare function deleteAllPersistentCacheIndexes(indexManager: PersistentCacheIndexManager): void;

매개변수

매개변수 유형 설명
indexManager PersistentCacheIndexManager

보고:

무효의

disablePersistentCacheIndexAutoCreation(indexManager)

Stops creating persistent cache indexes automatically for local query execution. The indexes which have been created by calling enablePersistentCacheIndexAutoCreation() still take effect.

서명:

export declare function disablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void;

매개변수

매개변수 유형 설명
indexManager PersistentCacheIndexManager

보고:

무효의

enablePersistentCacheIndexAutoCreation(indexManager)

Enables the SDK to create persistent cache indexes automatically for local query execution when the SDK believes cache indexes can help improve performance.

이 기능은 기본적으로 비활성화되어 있습니다.

서명:

export declare function enablePersistentCacheIndexAutoCreation(indexManager: PersistentCacheIndexManager): void;

매개변수

매개변수 유형 설명
indexManager PersistentCacheIndexManager

보고:

무효의

function(left, ...)

aggregateFieldEqual(left, right)

Compares two 'AggregateField ` instances for equality.

서명:

export declare function aggregateFieldEqual(left: AggregateField<unknown>, right: AggregateField<unknown>): boolean;

매개변수

매개변수 유형 설명
왼쪽 AggregateField <unknown> Compare this AggregateField to the right .
오른쪽 AggregateField <unknown> Compare this AggregateField to the left .

보고:

부울

aggregateQuerySnapshotEqual(left, right)

Compares two AggregateQuerySnapshot instances for equality.

Two AggregateQuerySnapshot instances are considered "equal" if they have underlying queries that compare equal, and the same data.

서명:

export declare function aggregateQuerySnapshotEqual<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(left: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>, right: AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>): boolean;

매개변수

매개변수 유형 설명
왼쪽 AggregateQuerySnapshot <AggregateSpecType, AppModelType, DbModelType> The first AggregateQuerySnapshot to compare.
오른쪽 AggregateQuerySnapshot <AggregateSpecType, AppModelType, DbModelType> The second AggregateQuerySnapshot to compare.

보고:

부울

true if the objects are "equal", as defined above, or false otherwise.

queryEqual(left, right)

Returns true if the provided queries point to the same collection and apply the same constraints.

서명:

export declare function queryEqual<AppModelType, DbModelType extends DocumentData>(left: Query<AppModelType, DbModelType>, right: Query<AppModelType, DbModelType>): boolean;

매개변수

매개변수 유형 설명
왼쪽 질문 <AppModelType, DbModelType> A Query to compare.
오른쪽 질문 <AppModelType, DbModelType> A Query to compare.

보고:

부울

true if the references point to the same location in the same Firestore database.

refEqual(left, right)

Returns true if the provided references are equal.

서명:

export declare function refEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>, right: DocumentReference<AppModelType, DbModelType> | CollectionReference<AppModelType, DbModelType>): boolean;

매개변수

매개변수 유형 설명
왼쪽 DocumentReference <AppModelType, DbModelType> | CollectionReference <AppModelType, DbModelType> A reference to compare.
오른쪽 DocumentReference <AppModelType, DbModelType> | CollectionReference <AppModelType, DbModelType> A reference to compare.

보고:

부울

true if the references point to the same location in the same Firestore database.

snapshotEqual(left, right)

Returns true if the provided snapshots are equal.

서명:

export declare function snapshotEqual<AppModelType, DbModelType extends DocumentData>(left: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>, right: DocumentSnapshot<AppModelType, DbModelType> | QuerySnapshot<AppModelType, DbModelType>): boolean;

매개변수

매개변수 유형 설명
왼쪽 문서스냅샷 <AppModelType, DbModelType> | QuerySnapshot <AppModelType, DbModelType> A snapshot to compare.
오른쪽 문서스냅샷 <AppModelType, DbModelType> | QuerySnapshot <AppModelType, DbModelType> A snapshot to compare.

보고:

부울

true if the snapshots are equal.

function(limit, ...)

limit(limit)

Creates a QueryLimitConstraint that only returns the first matching documents.

서명:

export declare function limit(limit: number): QueryLimitConstraint;

매개변수

매개변수 유형 설명
한계 숫자 The maximum number of items to return.

보고:

QueryLimitConstraint

The created QueryLimitConstraint .

limitToLast(limit)

Creates a QueryLimitConstraint that only returns the last matching documents.

You must specify at least one orderBy clause for limitToLast queries, otherwise an exception will be thrown during execution.

서명:

export declare function limitToLast(limit: number): QueryLimitConstraint;

매개변수

매개변수 유형 설명
한계 숫자 The maximum number of items to return.

보고:

QueryLimitConstraint

The created QueryLimitConstraint .

function(logLevel, ...)

setLogLevel(logLevel)

Sets the verbosity of Cloud Firestore logs (debug, error, or silent).

서명:

export declare function setLogLevel(logLevel: LogLevel): void;

매개변수

매개변수 유형 설명
logLevel LogLevel The verbosity you set for activity and error logging. Can be any of the following values:
  • debug for the most verbose logging level, primarily for debugging.
  • error to log errors only.
  • silent to turn off logging.

보고:

무효의

function(n, ...)

increment(n)

Returns a special value that can be used with setDoc() or updateDoc() that tells the server to increment the field's current value by the given value.

If either the operand or the current field value uses floating point precision, all arithmetic follows IEEE 754 semantics. If both values are integers, values outside of JavaScript's safe number range ( Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER ) are also subject to precision loss. Furthermore, once processed by the Firestore backend, all integer operations are capped between -2^63 and 2^63-1.

If the current field value is not of type number , or if the field does not yet exist, the transformation sets the field to the given value.

서명:

export declare function increment(n: number): FieldValue;

매개변수

매개변수 유형 설명
N 숫자 The value to increment by.

보고:

필드값

The FieldValue sentinel for use in a call to setDoc() or updateDoc()

function(query, ...)

getAggregateFromServer(query, aggregateSpec)

Calculates the specified aggregations over the documents in the result set of the given query without actually downloading the documents.

Using this function to perform aggregations is efficient because only the final aggregation values, not the documents' data, are downloaded. This function can perform aggregations of the documents in cases where the result set is prohibitively large to download entirely (thousands of documents).

The result received from the server is presented, unaltered, without considering any local state. That is, documents in the local cache are not taken into consideration, neither are local modifications not yet synchronized with the server. Previously-downloaded results, if any, are not used. Every invocation of this function necessarily involves a round trip to the server.

서명:

export declare function getAggregateFromServer<AggregateSpecType extends AggregateSpec, AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, aggregateSpec: AggregateSpecType): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query whose result set is aggregated over.
aggregateSpec AggregateSpecType An AggregateSpec object that specifies the aggregates to perform over the result set. The AggregateSpec specifies aliases for each aggregate, which can be used to retrieve the aggregate result.

보고:

Promise< AggregateQuerySnapshot <AggregateSpecType, AppModelType, DbModelType>>

const aggregateSnapshot = await getAggregateFromServer(query, {
  countOfDocs: count(),
  totalHours: sum('hours'),
  averageScore: average('score')
});

const countOfDocs: number = aggregateSnapshot.data().countOfDocs;
const totalHours: number = aggregateSnapshot.data().totalHours;
const averageScore: number | null = aggregateSnapshot.data().averageScore;

getCountFromServer(query)

Calculates the number of documents in the result set of the given query without actually downloading the documents.

Using this function to count the documents is efficient because only the final count, not the documents' data, is downloaded. This function can count the documents in cases where the result set is prohibitively large to download entirely (thousands of documents).

The result received from the server is presented, unaltered, without considering any local state. That is, documents in the local cache are not taken into consideration, neither are local modifications not yet synchronized with the server. Previously-downloaded results, if any, are not used. Every invocation of this function necessarily involves a round trip to the server.

서명:

export declare function getCountFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<AggregateQuerySnapshot<{
    count: AggregateField<number>;
}, AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query whose result set size is calculated.

보고:

Promise< AggregateQuerySnapshot <{ count: AggregateField <number>; }, AppModelType, DbModelType>>

A Promise that will be resolved with the count; the count can be retrieved from snapshot.data().count , where snapshot is the AggregateQuerySnapshot to which the returned Promise resolves.

getDocs(query)

Executes the query and returns the results as a QuerySnapshot .

서명:

export declare function getDocs<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType>

보고:

Promise< QuerySnapshot <AppModelType, DbModelType>>

A Promise that will be resolved with the results of the query.

getDocsFromCache(query)

Executes the query and returns the results as a QuerySnapshot from cache. Returns an empty result set if no documents matching the query are currently cached.

서명:

export declare function getDocsFromCache<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType>

보고:

Promise< QuerySnapshot <AppModelType, DbModelType>>

A Promise that will be resolved with the results of the query.

getDocsFromServer(query)

Executes the query and returns the results as a QuerySnapshot from the server. Returns an error if the network is not available.

서명:

export declare function getDocsFromServer<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>): Promise<QuerySnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType>

보고:

Promise< QuerySnapshot <AppModelType, DbModelType>>

A Promise that will be resolved with the results of the query.

onSnapshot(query, observer)

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, observer: {
    next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
    error?: (error: FirestoreError) => void;
    complete?: () => void;
}): Unsubscribe;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query to listen to.
관찰자 { next?: (snapshot: QuerySnapshot <AppModelType, DbModelType>) => void; error?: (error: FirestoreError ) => void; complete?: () => void; } A single object containing next and error callbacks.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(query, options, observer)

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
    next?: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void;
    error?: (error: FirestoreError) => void;
    complete?: () => void;
}): Unsubscribe;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query to listen to.
옵션 스냅샷 듣기 옵션 Options controlling the listen behavior.
관찰자 { next?: (snapshot: QuerySnapshot <AppModelType, DbModelType>) => void; error?: (error: FirestoreError ) => void; complete?: () => void; } A single object containing next and error callbacks.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(query, onNext, onError, onCompletion)

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query to listen to.
onNext (snapshot: QuerySnapshot <AppModelType, DbModelType>) => void A callback to be called every time a new QuerySnapshot is available.
onError (error: FirestoreError ) => void A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
onCompletion () => void Can be provided, but will not be called since streams are never ending.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(query, options, onNext, onError, onCompletion)

Attaches a listener for QuerySnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: QuerySnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The query to listen to.
옵션 스냅샷 듣기 옵션 Options controlling the listen behavior.
onNext (snapshot: QuerySnapshot <AppModelType, DbModelType>) => void A callback to be called every time a new QuerySnapshot is available.
onError (error: FirestoreError ) => void A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
onCompletion () => void Can be provided, but will not be called since streams are never ending.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

query(query, compositeFilter, queryConstraints)

Creates a new immutable instance of Query that is extended to also include additional query constraints.

서명:

export declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<AppModelType, DbModelType>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The Query instance to use as a base for the new constraints.
compositeFilter QueryCompositeFilterConstraint The QueryCompositeFilterConstraint to apply. Create QueryCompositeFilterConstraint using and() or or() .
queryConstraints QueryNonFilterConstraint [] Additional QueryNonFilterConstraint s to apply (eg orderBy() , 한계() ).

보고:

질문 <AppModelType, DbModelType>

예외

if any of the provided query constraints cannot be combined with the existing or new constraints.

query(query, queryConstraints)

Creates a new immutable instance of Query that is extended to also include additional query constraints.

서명:

export declare function query<AppModelType, DbModelType extends DocumentData>(query: Query<AppModelType, DbModelType>, ...queryConstraints: QueryConstraint[]): Query<AppModelType, DbModelType>;

매개변수

매개변수 유형 설명
질문 질문 <AppModelType, DbModelType> The Query instance to use as a base for the new constraints.
queryConstraints QueryConstraint [] The list of QueryConstraint s to apply.

보고:

질문 <AppModelType, DbModelType>

예외

if any of the provided query constraints cannot be combined with the existing or new constraints.

function(queryConstraints, ...)

and(queryConstraints)

Creates a new QueryCompositeFilterConstraint that is a conjunction of the given filter constraints. A conjunction filter includes a document if it satisfies all of the given filters.

서명:

export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;

매개변수

매개변수 유형 설명
queryConstraints QueryFilterConstraint [] 선택 과목. The list of QueryFilterConstraint s to perform a conjunction for. These must be created with calls to where() , 또는() , or and() .

보고:

QueryCompositeFilterConstraint

The newly created QueryCompositeFilterConstraint .

or(queryConstraints)

Creates a new QueryCompositeFilterConstraint that is a disjunction of the given filter constraints. A disjunction filter includes a document if it satisfies any of the given filters.

서명:

export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;

매개변수

매개변수 유형 설명
queryConstraints QueryFilterConstraint [] 선택 과목. The list of QueryFilterConstraint s to perform a disjunction for. These must be created with calls to where() , 또는() , or and() .

보고:

QueryCompositeFilterConstraint

The newly created QueryCompositeFilterConstraint .

function(reference, ...)

addDoc(reference, data)

Add a new document to specified CollectionReference with the given data, assigning it a document ID automatically.

서명:

export declare function addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
참조 CollectionReference <AppModelType, DbModelType> A reference to the collection to add this document to.
데이터 WithFieldValue <AppModelType> An Object containing the data for the new document.

보고:

Promise< DocumentReference <AppModelType, DbModelType>>

A Promise resolved with a DocumentReference pointing to the newly created document after it has been written to the backend (Note that it won't resolve while you're offline).

collection(reference, path, pathSegments)

Gets a CollectionReference instance that refers to a subcollection of reference at the the specified relative path.

서명:

export declare function collection<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
참조 CollectionReference <AppModelType, DbModelType> A reference to a collection.
A slash-separated path to a collection.
pathSegments 끈[] Additional path segments to apply relative to the first argument.

보고:

CollectionReference < DocumentData , DocumentData >

The CollectionReference instance.

예외

If the final path has an even number of segments and does not point to a collection.

collection(reference, path, pathSegments)

Gets a CollectionReference instance that refers to a subcollection of reference at the the specified relative path.

서명:

export declare function collection<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): CollectionReference<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to a Firestore document.
A slash-separated path to a collection.
pathSegments 끈[] Additional path segments that will be applied relative to the first argument.

보고:

CollectionReference < DocumentData , DocumentData >

The CollectionReference instance.

예외

If the final path has an even number of segments and does not point to a collection.

deleteDoc(reference)

Deletes the document referred to by the specified DocumentReference .

서명:

export declare function deleteDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<void>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to delete.

보고:

Promise<void>

A Promise resolved once the document has been successfully deleted from the backend (note that it won't resolve while you're offline).

doc(reference, path, pathSegments)

Gets a DocumentReference instance that refers to a document within reference at the specified relative path. If no path is specified, an automatically-generated unique ID will be used for the returned DocumentReference .

서명:

export declare function doc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, path?: string, ...pathSegments: string[]): DocumentReference<AppModelType, DbModelType>;

매개변수

매개변수 유형 설명
참조 CollectionReference <AppModelType, DbModelType> A reference to a collection.
A slash-separated path to a document. Has to be omitted to use auto-genrated IDs.
pathSegments 끈[] Additional path segments that will be applied relative to the first argument.

보고:

DocumentReference <AppModelType, DbModelType>

The DocumentReference instance.

예외

If the final path has an odd number of segments and does not point to a document.

doc(reference, path, pathSegments)

Gets a DocumentReference instance that refers to a document within reference at the specified relative path.

서명:

export declare function doc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, path: string, ...pathSegments: string[]): DocumentReference<DocumentData, DocumentData>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to a Firestore document.
A slash-separated path to a document.
pathSegments 끈[] Additional path segments that will be applied relative to the first argument.

보고:

DocumentReference < DocumentData , DocumentData >

The DocumentReference instance.

예외

If the final path has an odd number of segments and does not point to a document.

getDoc(reference)

Reads the document referred to by this DocumentReference .

서명:

export declare function getDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> The reference of the document to fetch.

보고:

Promise< DocumentSnapshot <AppModelType, DbModelType>>

A Promise resolved with a DocumentSnapshot containing the current document contents.

getDocFromCache(reference)

Reads the document referred to by this DocumentReference from cache. Returns an error if the document is not currently cached.

서명:

export declare function getDocFromCache<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType>

보고:

Promise< DocumentSnapshot <AppModelType, DbModelType>>

A Promise resolved with a DocumentSnapshot containing the current document contents.

getDocFromServer(reference)

Reads the document referred to by this DocumentReference from the server. Returns an error if the network is not available.

서명:

export declare function getDocFromServer<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>): Promise<DocumentSnapshot<AppModelType, DbModelType>>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType>

보고:

Promise< DocumentSnapshot <AppModelType, DbModelType>>

A Promise resolved with a DocumentSnapshot containing the current document contents.

onSnapshot(reference, observer)

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, observer: {
    next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
    error?: (error: FirestoreError) => void;
    complete?: () => void;
}): Unsubscribe;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to listen to.
관찰자 { next?: (snapshot: DocumentSnapshot <AppModelType, DbModelType>) => void; error?: (error: FirestoreError ) => void; complete?: () => void; } A single object containing next and error callbacks.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(reference, options, observer)

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, observer: {
    next?: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void;
    error?: (error: FirestoreError) => void;
    complete?: () => void;
}): Unsubscribe;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to listen to.
옵션 스냅샷 듣기 옵션 Options controlling the listen behavior.
관찰자 { next?: (snapshot: DocumentSnapshot <AppModelType, DbModelType>) => void; error?: (error: FirestoreError ) => void; complete?: () => void; } A single object containing next and error callbacks.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(reference, onNext, onError, onCompletion)

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to listen to.
onNext (snapshot: DocumentSnapshot <AppModelType, DbModelType>) => void A callback to be called every time a new DocumentSnapshot is available.
onError (error: FirestoreError ) => void A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
onCompletion () => void Can be provided, but will not be called since streams are never ending.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

onSnapshot(reference, options, onNext, onError, onCompletion)

Attaches a listener for DocumentSnapshot events. You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks.

NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending.

서명:

export declare function onSnapshot<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, options: SnapshotListenOptions, onNext: (snapshot: DocumentSnapshot<AppModelType, DbModelType>) => void, onError?: (error: FirestoreError) => void, onCompletion?: () => void): Unsubscribe;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to listen to.
옵션 스냅샷 듣기 옵션 Options controlling the listen behavior.
onNext (snapshot: DocumentSnapshot <AppModelType, DbModelType>) => void A callback to be called every time a new DocumentSnapshot is available.
onError (error: FirestoreError ) => void A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
onCompletion () => void Can be provided, but will not be called since streams are never ending.

보고:

구독 취소

An unsubscribe function that can be called to cancel the snapshot listener.

setDoc(reference, data)

Writes to the document referred to by this DocumentReference . If the document does not yet exist, it will be created.

서명:

export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<void>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to write.
데이터 WithFieldValue <AppModelType> A map of the fields and values for the document.

보고:

Promise<void>

A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).

setDoc(reference, data, options)

Writes to the document referred to by the specified DocumentReference . If the document does not yet exist, it will be created. If you provide merge or mergeFields , the provided data can be merged into an existing document.

서명:

export declare function setDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: PartialWithFieldValue<AppModelType>, options: SetOptions): Promise<void>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to write.
데이터 PartialWithFieldValue <AppModelType> A map of the fields and values for the document.
옵션 옵션 설정 An object to configure the set behavior.

보고:

Promise<void>

A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).

updateDoc(reference, data)

Updates fields in the document referred to by the specified DocumentReference . The update will fail if applied to a document that does not exist.

서명:

export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, data: UpdateData<DbModelType>): Promise<void>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to update.
데이터 UpdateData <DbModelType> An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.

보고:

Promise<void>

A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).

updateDoc(reference, field, value, moreFieldsAndValues)

Updates fields in the document referred to by the specified DocumentReference The update will fail if applied to a document that does not exist.

Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects.

서명:

export declare function updateDoc<AppModelType, DbModelType extends DocumentData>(reference: DocumentReference<AppModelType, DbModelType>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;

매개변수

매개변수 유형 설명
참조 DocumentReference <AppModelType, DbModelType> A reference to the document to update.
필드 문자열 | FieldPath The first field to update.
알려지지 않은 The first value.
moreFieldsAndValues 알려지지 않은[] Additional key value pairs.

보고:

Promise<void>

A Promise resolved once the data has been successfully written to the backend (note that it won't resolve while you're offline).

function(settings, ...)

memoryLocalCache(settings)

Creates an instance of MemoryLocalCache . The instance can be set to FirestoreSettings.cache to tell the SDK which cache layer to use.

서명:

export declare function memoryLocalCache(settings?: MemoryCacheSettings): MemoryLocalCache;

매개변수

매개변수 유형 설명
설정 MemoryCacheSettings

보고:

MemoryLocalCache

memoryLruGarbageCollector(settings)

Creates an instance of MemoryLruGarbageCollector .

A target size can be specified as part of the setting parameter. The collector will start deleting documents once the cache size exceeds the given size. The default cache size is 40MB (40 * 1024 * 1024 bytes).

서명:

export declare function memoryLruGarbageCollector(settings?: {
    cacheSizeBytes?: number;
}): MemoryLruGarbageCollector;

매개변수

매개변수 유형 설명
설정 { cacheSizeBytes?: number; }

보고:

MemoryLruGarbageCollector

persistentLocalCache(settings)

Creates an instance of PersistentLocalCache . The instance can be set to FirestoreSettings.cache to tell the SDK which cache layer to use.

Persistent cache cannot be used in a Node.js environment.

서명:

export declare function persistentLocalCache(settings?: PersistentCacheSettings): PersistentLocalCache;

매개변수

매개변수 유형 설명
설정 PersistentCacheSettings

보고:

PersistentLocalCache

persistentSingleTabManager(settings)

Creates an instance of PersistentSingleTabManager .

서명:

export declare function persistentSingleTabManager(settings: PersistentSingleTabManagerSettings | undefined): PersistentSingleTabManager;

매개변수

매개변수 유형 설명
설정 PersistentSingleTabManagerSettings | 한정되지 않은 Configures the created tab manager.

보고:

PersistentSingleTabManager

function(snapshot, ...)

endAt(snapshot)

Creates a QueryEndAtConstraint that modifies the result set to end at the provided document (inclusive). The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.

서명:

export declare function endAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryEndAtConstraint;

매개변수

매개변수 유형 설명
스냅 사진 문서스냅샷 <AppModelType, DbModelType> The snapshot of the document to end at.

보고:

QueryEndAtConstraint

A QueryEndAtConstraint to pass to query()

endBefore(snapshot)

Creates a QueryEndAtConstraint that modifies the result set to end before the provided document (exclusive). The end position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.

서명:

export declare function endBefore<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryEndAtConstraint;

매개변수

매개변수 유형 설명
스냅 사진 문서스냅샷 <AppModelType, DbModelType> The snapshot of the document to end before.

보고:

QueryEndAtConstraint

A QueryEndAtConstraint to pass to query()

startAfter(snapshot)

Creates a QueryStartAtConstraint that modifies the result set to start after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query.

서명:

export declare function startAfter<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint;

매개변수

매개변수 유형 설명
스냅 사진 문서스냅샷 <AppModelType, DbModelType> The snapshot of the document to start after.

보고:

QueryStartAtConstraint

A QueryStartAtConstraint to pass to query()

startAt(snapshot)

Creates a QueryStartAtConstraint that modifies the result set to start at the provided document (inclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query.

서명:

export declare function startAt<AppModelType, DbModelType extends DocumentData>(snapshot: DocumentSnapshot<AppModelType, DbModelType>): QueryStartAtConstraint;

매개변수

매개변수 유형 설명
스냅 사진 문서스냅샷 <AppModelType, DbModelType> The snapshot of the document to start at.

보고:

QueryStartAtConstraint

A QueryStartAtConstraint to pass to query() .

CACHE_SIZE_UNLIMITED

Constant used to indicate the LRU garbage collection should be disabled. Set this value as the cacheSizeBytes on the settings passed to the Firestore instance.

서명:

CACHE_SIZE_UNLIMITED = -1

AddPrefixToKeys

Returns a new map where every key is prefixed with the outer key appended to a dot.

서명:

export declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
    [K in keyof T & string as `${Prefix}.${K}`]+?: string extends K ? any : T[K];
};

AggregateFieldType

The union of all AggregateField types that are supported by Firestore.

서명:

export declare type AggregateFieldType = ReturnType<typeof sum> | ReturnType<typeof average> | ReturnType<typeof count>;

AggregateSpecData

A type whose keys are taken from an AggregateSpec , and whose values are the result of the aggregation performed by the corresponding AggregateField from the input AggregateSpec .

서명:

export declare type AggregateSpecData<T extends AggregateSpec> = {
    [P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
};

AggregateType

Union type representing the aggregate type to be performed.

서명:

export declare type AggregateType = 'count' | 'avg' | 'sum';

ChildUpdateFields

Helper for calculating the nested fields for a given type T1. This is needed to distribute union types such as undefined | {...} (happens for optional props) or {a: A} | {b: B} .

In this use case, V is used to distribute the union types of T[K] on Record , since T[K] is evaluated as an expression and not distributed.

See https://www.typescriptlang.org/docs/handbook/advanced-types.html#distributive-conditional-types

서명:

export declare type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never;

DocumentChangeType

The type of a DocumentChange may be 'added', 'removed', or 'modified'.

서명:

export declare type DocumentChangeType = 'added' | 'removed' | 'modified';

FirestoreErrorCode

The set of Firestore status codes. The codes are the same at the ones exposed by gRPC here: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md

Possible values: - 'cancelled': The operation was cancelled (typically by the caller). - 'unknown': Unknown error or an error from a different error domain. - 'invalid-argument': Client specified an invalid argument. Note that this differs from 'failed-precondition'. 'invalid-argument' indicates arguments that are problematic regardless of the state of the system (eg an invalid field name). - 'deadline-exceeded': Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire. - 'not-found': Some requested document was not found. - 'already-exists': Some document that we attempted to create already exists. - 'permission-denied': The caller does not have permission to execute the specified operation. - 'resource-exhausted': Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. - 'failed-precondition': Operation was rejected because the system is not in a state required for the operation's execution. - 'aborted': The operation was aborted, typically due to a concurrency issue like transaction aborts, etc. - 'out-of-range': Operation was attempted past the valid range. - 'unimplemented': Operation is not implemented or not supported/enabled. - 'internal': Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. - 'unavailable': The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff. - 'data-loss': Unrecoverable data loss or corruption. - 'unauthenticated': The request does not have valid authentication credentials for the operation.

서명:

export declare type FirestoreErrorCode = 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated';

FirestoreLocalCache

Union type from all supported SDK cache layer.

서명:

export declare type FirestoreLocalCache = MemoryLocalCache | PersistentLocalCache;

ListenSource

Describe the source a query listens to.

Set to default to listen to both cache and server changes. Set to cache to listen to changes in cache only.

서명:

export declare type ListenSource = 'default' | 'cache';

MemoryGarbageCollector

Union type from all support gabage collectors for memory local cache.

서명:

export declare type MemoryGarbageCollector = MemoryEagerGarbageCollector | MemoryLruGarbageCollector;

NestedUpdateFields

For each field (eg 'bar'), find all nested keys (eg { 'bar.baz': T1, 'bar.qux': T2 } ). Intersect them together to make a single map containing all possible keys that are all marked as optional

서명:

export declare type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{
    [K in keyof T & string]: ChildUpdateFields<K, T[K]>;
}[keyof T & string]>;

OrderByDirection

The direction of a orderBy() clause is specified as 'desc' or 'asc' (descending or ascending).

서명:

export declare type OrderByDirection = 'desc' | 'asc';

PartialWithFieldValue

Similar to Typescript's Partial<T> , but allows nested fields to be omitted and FieldValues to be passed in as property values.

서명:

export declare type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive ? T : T extends {} ? {
    [K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue;
} : never);

PersistentTabManager

A union of all available tab managers.

서명:

export declare type PersistentTabManager = PersistentSingleTabManager | PersistentMultipleTabManager;

원어

Primitive types.

서명:

export declare type Primitive = string | number | boolean | undefined | null;

QueryConstraintType

Describes the different query constraints available in this SDK.

서명:

export declare type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore';

QueryFilterConstraint

QueryFilterConstraint is a helper union type that represents QueryFieldFilterConstraint and QueryCompositeFilterConstraint .

서명:

export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;

QueryNonFilterConstraint

QueryNonFilterConstraint is a helper union type that represents QueryConstraints which are used to narrow or order the set of documents, but that do not explicitly filter on a document field. QueryNonFilterConstraint s are created by invoking orderBy() , startAt() , startAfter() , endBefore() , endAt() , limit() or limitToLast() and can then be passed to query() to create a new query instance that also contains the QueryConstraint .

서명:

export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;

옵션 설정

An options object that configures the behavior of setDoc() , and calls. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions with merge: true .

서명:

export declare type SetOptions = {
    readonly merge?: boolean;
} | {
    readonly mergeFields?: Array<string | FieldPath>;
};

TaskState

Represents the state of bundle loading tasks.

Both 'Error' and 'Success' are sinking state: task will abort or complete and there will be no more updates after they are reported.

서명:

export declare type TaskState = 'Error' | 'Running' | 'Success';

UnionToIntersection

Given a union type U = T1 | T2 | ... , returns an intersected type (T1 & T2 & ...) .

Uses distributive conditional types and inference from conditional types. This works because multiple candidates for the same type variable in contra-variant positions causes an intersection type to be inferred. https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types https://stackoverflow.com/questions/50374908/transform-union-type-to-intersection -유형

서명:

export declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;

UpdateData

Update data (for use with updateDoc() ) that consists of field paths (eg 'foo' or 'foo.baz') mapped to values. Fields that contain dots reference nested fields within the document. FieldValues can be passed in as property values.

서명:

export declare type UpdateData<T> = T extends Primitive ? T : T extends {} ? {
    [K in keyof T]?: UpdateData<T[K]> | FieldValue;
} & NestedUpdateFields<T> : Partial<T>;

WhereFilterOp

Filter conditions in a where() clause are specified using the strings '&lt;', '&lt;=', '==', '!=', '&gt;=', '&gt;', 'array-contains', 'in', 'array-contains-any', and 'not-in'.

서명:

export declare type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';

WithFieldValue

Allows FieldValues to be passed in as a property value while maintaining type safety.

서명:

export declare type WithFieldValue<T> = T | (T extends Primitive ? T : T extends {} ? {
    [K in keyof T]: WithFieldValue<T[K]> | FieldValue;
} : never);