跳过主要内容
返回插件
@capgo/capacitor-firebase-firestore
教程
@capgo/capacitor-firebase-firestore

Firebase Firestore

Capacitor用于Firebase Cloud Firestore的插件

指南

Firebase Firestore 的教程

使用@capgo/capacitor-firebase-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);

- 全部参考

- 从使用@capgo/capacitor-firebase-firestore继续。

- 如果您正在使用 使用@capgo/capacitor-firebase-firestore 规划本机插件工作,连接它 Capgo 插件目录 在Capgo 插件目录中 Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, 在__CAPGO_KEEP_0__ 插件中 __CAPGO_KEEP_0__ 插件 __CAPGO_KEEP_1__ 插件的实现细节 Capgo Native Builds for the product workflow in Capgo Native Builds.