Getting Started
설치 단계와 이 플러그인의 전체 마크다운 가이드와 함께 설정 프롬프트를 복사합니다.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-firebase-firestore`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/firebase-firestore/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치 제목bun add @capgo/capacitor-firebase-firestorebunx cap syncImport
임포트 섹션import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';API 개요
API 개요 섹션addDocument
문서 추가문서 추가: 지정된 데이터로 컬렉션에 새로운 문서를 추가합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addDocument({} as AddDocumentOptions);setDocument
문서 설정문서 설정: 지정된 참조에 해당하는 문서에 데이터를 씁니다. 문서가 존재하지 않으면 새로 생성됩니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.setDocument({} as SetDocumentOptions);getDocument
문서 가져오기__CAPGO_KEEP_0__을 지정한 참조에 의해 참조되는 문서를 읽습니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getDocument({} as GetDocumentOptions);updateDocument
__CAPGO_KEEP_0__ 섹션__CAPGO_KEEP_0__을 지정한 참조에 의해 참조되는 문서의 field를 업데이트합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.updateDocument({} as UpdateDocumentOptions);deleteDocument
__CAPGO_KEEP_0__ 섹션__CAPGO_KEEP_0__을 지정한 참조에 의해 참조되는 문서를 삭제합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.deleteDocument({} as DeleteDocumentOptions);writeBatch
__CAPGO_KEEP_0__ 섹션여러 개의 쓰기 작업을 단일 배치로 실행합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.writeBatch({} as WriteBatchOptions);getCollection
__CAPGO_KEEP_0__ 섹션__CAPGO_KEEP_0__을 지정한 참조에 의해 참조되는 컬렉션을 읽습니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCollection({} as GetCollectionOptions);getCollectionGroup
getCollectionGroup 섹션 제목__CAPGO_KEEP_0__을 지정한 참조에 의해 참조되는 컬렉션 그룹을 읽습니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCollectionGroup({} as GetCollectionGroupOptions);getCountFromServer
getCountFromServer 섹션 제목서버에서 문서의 수를 가져옵니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCountFromServer({} as GetCountFromServerOptions);clearPersistence
clearPersistence 섹션 제목저장소의 지속성을 삭제합니다. 이에는 대기 중인 쓰기와 캐시된 문서가 포함됩니다.
앱이 종료되거나 앱이 처음 초기화될 때 호출해야 합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.clearPersistence();enableNetwork
네트워크 사용을 재 활성화합니다.네트워크 사용을 재 활성화합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.enableNetwork();disableNetwork
네트워크 사용을 비활성화합니다.네트워크 사용을 비활성화합니다.
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.disableNetwork();useEmulator
앱을 Firestore 에뮬레이터와 통신하도록 구성합니다.클립보드에 복사
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.useEmulator({} as UseEmulatorOptions);addDocumentSnapshotListener
클립보드에 복사__CAPGO_KEEP_0__
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addDocumentSnapshotListener({} as AddDocumentSnapshotListenerOptions, {} as AddDocumentSnapshotListenerCallback<T>);addCollectionSnapshotListener
addCollectionSnapshotListenercollection snapshot 이벤트 리스너 추가
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addCollectionSnapshotListener({} as AddCollectionSnapshotListenerOptions, {} as AddCollectionSnapshotListenerCallback<T>);addCollectionGroupSnapshotListener
addCollectionGroupSnapshotListenercollection group snapshot 이벤트 리스너 추가
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addCollectionGroupSnapshotListener({} as AddCollectionGroupSnapshotListenerOptions, {} as AddCollectionGroupSnapshotListenerCallback<T>);removeSnapshotListener
removeSnapshotListener문서 또는 collection snapshot 이벤트 리스너 제거
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.removeSnapshotListener({} as RemoveSnapshotListenerOptions);Type Reference
Type ReferenceAddDocumentOptions
AddDocumentOptionsexport interface AddDocumentOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 * @example 'users' */ reference: string; /** * An object containing the data for the new document. * * @since 5.2.0 * @example { first: 'Alan', last: 'Turing', born: 1912 } */ data: DocumentData;}AddDocumentResult
AddDocumentResult 섹션export interface AddDocumentResult { /** * The reference of the newly added document. * * @since 5.2.0 */ reference: DocumentReference;}SetDocumentOptions
SetDocumentOptions 섹션export interface SetDocumentOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 * @example 'users/Aorq09lkt1ynbR7xhTUx' */ reference: string; /** * An object containing the data for the new document. * * @since 5.2.0 * @example { first: 'Alan', last: 'Turing', born: 1912 } */ data: DocumentData; /** * Whether to merge the provided data with an existing document. * * @since 5.2.0 * @example true * @default false */ merge?: boolean;}DocumentData
DocumentData 섹션export interface DocumentData { /** * A mapping between a field and its value. * * @since 5.2.0 */ [field: string]: any;}GetDocumentOptions
GetDocumentOptions 섹션export interface GetDocumentOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 */ reference: string;}GetDocumentResult
GetDocumentResult 섹션export interface GetDocumentResult<T> { /** * The current document contents. * * @since 5.2.0 */ snapshot: DocumentSnapshot<T>;}UpdateDocumentOptions
UpdateDocumentOptions 섹션export interface UpdateDocumentOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 */ reference: string; /** * An object containing the data for the new document. * * @since 5.2.0 * @example { first: 'Alan', last: 'Turing', born: 1912 } */ data: DocumentData;}DeleteDocumentOptions
DeleteDocumentOptions 섹션 제목export interface DeleteDocumentOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 */ reference: string;}WriteBatchOptions
WriteBatchOptions 섹션 제목export interface WriteBatchOptions { /** * The operations to execute in the batch. * * @since 6.1.0 */ operations: WriteBatchOperation[];}GetCollectionOptions
GetCollectionOptions 섹션 제목export interface GetCollectionOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 */ reference: string; /** * The filter to apply. * * @since 5.2.0 */ compositeFilter?: QueryCompositeFilterConstraint; /** * Narrow or order the set of documents to retrieve, but do not explicitly filter for document fields. * * @since 5.2.0 */ queryConstraints?: QueryNonFilterConstraint[];}GetCollectionResult
GetCollectionResult 섹션 제목export interface GetCollectionResult<T> { /** * The documents in the collection. * * @since 5.2.0 */ snapshots: DocumentSnapshot<T>[];}GetCollectionGroupOptions
GetCollectionGroupOptions 섹션 제목export interface GetCollectionGroupOptions { /** * The reference as a string, with path components separated by a forward slash (`/`). * * @since 5.2.0 */ reference: string; /** * The filter to apply. * * @since 5.2.0 */ compositeFilter?: QueryCompositeFilterConstraint; /** * Narrow or order the set of documents to retrieve, but do not explicitly filter for document fields. * * @since 5.2.0 */ queryConstraints?: QueryNonFilterConstraint[];}Source Of Truth
Source Of Truth이 페이지는 플러그인의 src/definitions.ts업스트림의 공공 API이 변경될 때 다시 싱크를 실행하세요.
Getting Started
Getting Started이 플러그인을 사용 중이라면 Getting Started 계획 대시보드 및 API 연산을 위해 연결하세요. API Overview API Overview __CAPGO_KEEP_0__ Overview Introduction API 키 implementation 세부 정보에 대한 API 키 장치 implementation 세부 정보에 대한 장치 배포 implementation 세부 정보에 대한 배포