This package has been deprecated

Author message:

Package renamed to fireboost. Please visit https://www.npmjs.com/package/fireboost

admin-utils-firestore
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

Admin Utils Firestore

npm Travis NPM Code Style: Google


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:
import {FirestoreAdminUtils} from 'admin-utils-firestore';
const adminUtilsFirestore = new FirestoreAdminUtils();

Documentation:

Collections

Target a firestore collection reference via:

const colRef = db.collection('test');
const utilColRef = adminUtilsFirestore.ref(colRef);
API
  • deleteFieldDocs
    For each documents in a referenced collection performs a delete operation of the old field key
utilColRef.deleteFieldDocs('fieldKeyToDelete')
  • importDocs
    Allow to import documents in a collection using a bulk operation
utilColRef.importDocs({uid: '1'}, {uid: '2', name: 'Giovanni'})
  • renameFieldDocs
    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
utilColRef.renameFieldDocs({oldFieldKey: 'newFieldKey'})
Documents

Target a firestore document reference via:

const docRef = db.collection('users').doc('xyz');
const utilDocRef = adminUtilsFirestore.ref(docRef);
API
  • renameField
    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
utilDocRef.renameField({oldFieldKey: 'newFieldKey'})

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.

Package Sidebar

Install

npm i admin-utils-firestore

Weekly Downloads

0

Version

0.1.6

License

MIT

Unpacked Size

14.4 kB

Total Files

6

Last publish

Collaborators

  • 39ro