ガイド
Capacitor で Firebase Firestore を使う方法
@capgo/capacitor-firebase-firestore の使用方法
Firebase Cloud Firestore 用の Capacitor プラグイン
インストール
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
指定されたリファレンスが指すドキュメント内のフィールドを更新します。
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/capacitor-firebase-firestore の使用方法 ネイティブプラグインの作業を計画するには、次と連携してください: Capgo プラグインディレクトリ Capgo プラグインディレクトリのプロダクトワークフローについては、 Capgo による Capacitor プラグイン Capgo による Capacitor プラグインの実装詳細については、 プラグインの追加または更新 プラグインの追加または更新に関する実装詳細については、 Ionic Enterprise プラグインの代替案 Ionic Enterprise Plugin Alternatives のプロダクトワークフロー、および Capgo Native Build Capgo Native Builds のプロダクトワークフローについては、