1.5.0 • Published 2 years ago

@jackdbd/firestore-utils v1.5.0

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

@jackdbd/firestore-utils

npm version Snyk Vulnerabilities for npm package

Utility functions to work with Firestore.

Installation

npm install @jackdbd/firestore-utils

⚠️ Warning:

This library declares @google-cloud/firestore as peer dependency.

Usage

You can import the top-level module:

import { Firestore } from '@google-cloud/firestore'
import {
  bulkCopy,
  bulkDelete,
  bulkMove,
  moveData,
  shuffleWithFisherYates,
  docResultsWithData
} from '@jackdbd/firestore-utils'

const firestore = new Firestore()
const collection_ref = firestore.collection('some-collection')

const result_copy = await bulkCopy({
  copied_by: 'someone',
  dest_collection: 'some-other-collection',
  query: collection_ref.where('some-field', '>=', 42)
})

const result_move = await bulkMove({
  moved_by: 'someone',
  dest_collection: 'some-other-collection',
  query: collection_ref.where('some-field', '>=', 42)
})

await shuffleWithFisherYates(collection_ref)

const result_delete = await bulkDelete({ query: collection_ref })

or a specific ES module:

import { bulkCopy } from '@jackdbd/firestore-utils/copy'

import { bulkDelete } from '@jackdbd/firestore-utils/delete'

import {
  bulkMove,
  moveData,
  shuffleWithFisherYates
} from '@jackdbd/firestore-utils/move'

import { docResultsWithData } from '@jackdbd/firestore-utils/retrieve'

API

API docs generated with TypeDoc

1.2.0

2 years ago

1.4.1-canary.1

2 years ago

1.4.0-canary.2

2 years ago

1.4.0-canary.3

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.3.0-canary.1

2 years ago

1.4.0-canary.1

2 years ago

1.1.0

2 years ago

1.2.0-canary.1

2 years ago

1.0.0

2 years ago