# @tridnguyen/firestore

> Simple wrapper around firestore node package

Latest version **2.1.1** (published 2022-03-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install @tridnguyen/firestore
pnpm add @tridnguyen/firestore
yarn add @tridnguyen/firestore
bun add @tridnguyen/firestore
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2022-03-12 |
| First published | 2019-03-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tri Nguyen |
| Maintainers | tridnguyen |
| Keywords | firestore |

## Links

- npm: https://www.npmjs.com/package/@tridnguyen/firestore
- Repository: https://github.com/tnguyen14/firestore
- Homepage: https://github.com/tnguyen14/firestore#readme
- Issues: https://github.com/tnguyen14/firestore/issues
- npm.io page: https://npm.io/package/@tridnguyen/firestore

## Dependencies (1)

- [@google-cloud/firestore](https://npm.io/package/@google-cloud/firestore.md) ^5.0.2

## Recent versions

- 2.1.1 (latest) — 2022-03-12
- 2.1.0 — 2020-07-22
- 2.0.0 — 2020-04-10
- 1.0.2 — 2020-04-10
- 1.0.1 — 2019-07-14
- 1.0.0 — 2019-03-15

## README

# @tridnguyen/firestore

> Simple wrapper around @google-cloud/firestore package

## Environment variables

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

```shell
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>.

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

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

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

---
_Source: https://npm.io/package/@tridnguyen/firestore · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
