# admin-utils-firestore

> Unofficial library Node.js Utils class for Firestore (https://firebase.google.com/docs/firestore)

Latest version **0.1.6** (published 2020-04-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install admin-utils-firestore
pnpm add admin-utils-firestore
yarn add admin-utils-firestore
bun add admin-utils-firestore
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2020-04-29 |
| First published | 2020-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 2 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | 39ro |
| Maintainers | 39ro |
| Keywords | firestore, nodejs, typescript, utils |

## Links

- npm: https://www.npmjs.com/package/admin-utils-firestore
- Repository: https://github.com/39ro/admin-utils-firestore
- Homepage: https://github.com/39ro/admin-utils-firestore#readme
- Issues: https://github.com/39ro/admin-utils-firestore/issues
- npm.io page: https://npm.io/package/admin-utils-firestore

## Dependencies (2)

- [firebase-admin](https://npm.io/package/firebase-admin.md) ^8.11.0
- [@google-cloud/firestore](https://npm.io/package/@google-cloud/firestore.md) ^3.7.5

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2020-04-29
- 0.1.5 — 2020-01-18
- 0.1.4 — 2020-01-12
- 0.1.3 — 2020-01-09
- 0.1.2 — 2020-01-09
- 0.1.1 — 2020-01-09
- 0.1.0 — 2020-01-09

## README

<div align="center">
  <h1>Admin Utils Firestore</h1>
</div>

![npm](https://img.shields.io/npm/v/admin-utils-firestore.svg)
![Travis](https://img.shields.io/travis/39ro/admin-utils-firestore)
![NPM](https://img.shields.io/npm/l/admin-utils-firestore)
[![Code Style: Google](https://img.shields.io/badge/code%20style-google-blueviolet.svg)](https://github.com/google/gts)

<hr>

Helpers used for common admin task on Firestore databases.


### Installation:

- Install the package via:
```
$ npm install --save admin-utils-firestore
```

- Init admin-utils-firestore via:
```javascript
import {FirestoreAdminUtils} from 'admin-utils-firestore';
const adminUtilsFirestore = new FirestoreAdminUtils();
```

<hr>

### Documentation:

##### Collections
Target a firestore collection reference via:
```javascript
const colRef = db.collection('test');
const utilColRef = adminUtilsFirestore.ref(colRef);
```

###### API

- **deleteFieldDocs**<br>
_For each documents in a referenced collection performs a delete operation of the old field key_
```javascript
utilColRef.deleteFieldDocs('fieldKeyToDelete')
```

- **importDocs**<br>
_Allow to import documents in a collection using a bulk operation_
```javascript
utilColRef.importDocs({uid: '1'}, {uid: '2', name: 'Giovanni'})
```

- **renameFieldDocs**<br>
_For each documents in a referenced collection performs a update operation of the new field key, and then performs, if it exist, a remove operation of the old field key_
```javascript
utilColRef.renameFieldDocs({oldFieldKey: 'newFieldKey'})
```


##### Documents
Target a firestore document reference via:
```javascript
const docRef = db.collection('users').doc('xyz');
const utilDocRef = adminUtilsFirestore.ref(docRef);
```

###### API

- **renameField**<br>
_For the referenced document performs a update operation of the new field key, and then performs, if it exist, a remove operation of the old field key_
```javascript
utilDocRef.renameField({oldFieldKey: 'newFieldKey'})
```


<br>


### Just a reminder
This in a unofficial library for Firestore (https://firebase.google.com/docs/firestore) we recommend replicating the operation, where it's possible, in a test project to check if the output is what expected before to run any operation in a production environment.
Thanks for using and testing this library!

### Contributing
For bugs and feature requests please [Create an Issue](https://github.com/39ro/admin-utils-firestore/issues/new).

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