指南
关于 Firebase Firestore 的教程
使用@capgo/capacitor-firebase-firestore
Capacitor插件用于 Firebase Cloud Firestore。
安装
bun add @capgo/capacitor-firebase-firestore
bunx cap sync
此插件暴露了什么
addDocument- 在指定的集合中添加一个新文档,文档的数据由给定的数据决定。setDocument- 将数据写入指定的引用指向的文档。如果文档尚未存在,则会创建一个。getDocument- 读取指定的引用指向的文档。updateDocument- 指定参考指向的文档中的字段进行更新。
Example Usage
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);
Full Reference
- GitHub: https://github.com/Cap-go/capacitor-firebase/tree/main/packages/firestore
- Docs: /docs/plugins/firebase-firestore/
继续使用@capgo/capacitor-firebase-firestore
如果您正在使用 使用 @capgo/capacitor-firebase-firestore 规划原生插件工作,连接它到 Capgo 原生插件目录 在 Capgo 原生插件目录中, Capacitor 插件由 Capgo 在 Capacitor 插件由 Capgo 中, 添加或更新插件 在添加或更新插件中, Ionic 企业插件替代品 在 Ionic 企业插件替代品中, Capgo 原生构建 在 Capgo 原生构建中,