Skip to main content
Back to plugins
@capgo/capacitor-firebase-firestore
Tutorial
by github.com/Cap-go

Firebase Firestore

Capacitor plugin for Firebase Cloud Firestore

Guide

Tutorial on Firebase Firestore

Using @capgo/capacitor-firebase-firestore

Capacitor plugin for Firebase Cloud Firestore.

Install

bun add @capgo/capacitor-firebase-firestore
bunx cap sync

What This Plugin Exposes

  • addDocument - Adds a new document to a collection with the given data.
  • setDocument - Writes to the document referred to by the specified reference. If the document does not yet exist, it will be created.
  • getDocument - Reads the document referred to by the specified reference.
  • updateDocument - Updates fields in the document referred to by the specified reference.

Example Usage

addDocument

Adds a new document to a collection with the given data.

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';

await FirebaseFirestore.addDocument({} as AddDocumentOptions);

setDocument

Writes to the document referred to by the specified reference. If the document does not yet exist, it will be created.

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';

await FirebaseFirestore.setDocument({} as SetDocumentOptions);

getDocument

Reads the document referred to by the specified reference.

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';

await FirebaseFirestore.getDocument({} as GetDocumentOptions);

updateDocument

Updates fields in the document referred to by the specified reference.

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';

await FirebaseFirestore.updateDocument({} as UpdateDocumentOptions);

Full Reference

Keep going from Using @capgo/capacitor-firebase-firestore

If you are using Using @capgo/capacitor-firebase-firestore to plan native plugin work, connect it with Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives, and Capgo Native Builds for the product workflow in Capgo Native Builds.