指南
Firebase Firestore 的教程
使用@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
- 根据指定的引用更新文档中的字段。
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 插件目录中 Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, 添加或更新插件 在添加或更新插件中 Ionic 企业插件替代品 在Ionic 企业插件替代品中 Capgo 本机构建 在Capgo 本机构建中