2.1.1 • Published 2 years ago

@tridnguyen/firestore v2.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@tridnguyen/firestore

Simple wrapper around @google-cloud/firestore package

Environment variables

This package assumes the following environment variables to always be set:

FIRESTORE_PROJECT_ID=<your-google-cloud-project-id>
GOOGLE_APPLICATION_CREDENTIALS=<path-to-service-account-json-file>
# instructions for service account
# https://cloud.google.com/docs/authentication/getting-started

Delete collection

The main reason for this package to exist is the implementation of the deleteCollection method, which retrieve all documents within the collection or subcollection and delete them, in batches. Inspired by https://firebase.google.com/docs/firestore/manage-data/delete-data#collections.

const { firestore } = require('@tridnguyen/firestore');

const myDocRef = firestore.doc('docs/my-doc');

firestore.deleteCollection('docs/my-doc/sub-collection')
  .then(() => {
    return myDocRef.delete();
  });
2.1.1

2 years ago

2.1.0

4 years ago

1.0.2

4 years ago

2.0.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago