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

Firebase Firestore

Capacitor与Firebase Cloud Firestore的集成

指南

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);

- 全部参考

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

- 如果您正在使用 使用@capgo/capacitor-firebase-firestore 规划本机插件工作,连接它 Capgo 插件目录 在Capgo 插件目录中 Capacitor 插件由Capgo 在Capacitor 插件由Capgo中 添加或更新插件 添加或更新插件的实现细节 Ionic 企业插件替代品 在Ionic 企业插件替代品中 Capgo 本机构建 在Capgo 本机构建中