ガイド
Firebase Firestore を Capacitor で使用する方法
@capgo/capacitor-firebase-firestore を使用します。
Capacitor は Firebase Cloud Firestore のプラグインです。
インストール
bun add @capgo/capacitor-firebase-firestore
bunx cap sync
このプラグインが公開するもの
addDocument- 指定されたデータでコレクションに新しいドキュメントを追加します。setDocument- 指定された参照で参照されるドキュメントに書き込む。ドキュメントがまだ存在しない場合は作成されます。getDocument- 指定された参照で参照されるドキュメントを読み取ります。updateDocument- 指定された参照で参照されるドキュメントのフィールドを更新します。
使用例
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
指定された参照で参照されるドキュメントを読み取ります。
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getDocument({} as GetDocumentOptions);
updateDocument
__CAPGO_KEEP_0__のドキュメントを指定された参照によって参照されるドキュメントのフィールドを更新します。
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.updateDocument({} as UpdateDocumentOptions);
フルリファレンス
- GitHub: https://github.com/Cap-go/capacitor-firebase/tree/main/packages/firestore
- ドキュメント: /docs/plugins/firebase-firestore/
使用から続けて@capgo/capacitor-firebase-firestore
__CAPGO_KEEP_0__を使用している場合 Capgoは@capgo/capacitor-firebase-firestoreを使用します。 プラグインのネイティブワークを計画するには、接続する Capgo Plugin Directoryの製品ワークフローにCapgo Plugin Directoryを接続します。 Capgoの__CAPGO_KEEP_1__によって提供されるプラグイン Capacitor Capgo Capgoプラグインの実装詳細については、Capacitor プラグインによってCapgoで プラグインの追加または更新 Capgoプラグインの実装詳細については、プラグインの追加または更新 Ionic Enterpriseプラグインの代替 Ionic Enterpriseプラグインのワークフローについて、 Capgoネイティブビルド Capgoプラグインのワークフローについて、Capgoネイティブビルド