All Projects → goto-bus-stop → keyv-firestore

goto-bus-stop / keyv-firestore

Licence: other
Firebase Cloud Firestore backend for Keyv, the simple persistent key-value storage module

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to keyv-firestore

Keyv
Simple key-value storage with support for multiple backends
Stars: ✭ 1,629 (+13475%)
Mutual labels:  keyv
deno-keyv
A simple, easy to use key-value database wrapper for Deno
Stars: ✭ 16 (+33.33%)
Mutual labels:  keyv

keyv-firestore

Firebase Cloud Firestore backend for Keyv, the simple persistent key-value storage module

Install - Usage - License: Apache-2.0

npm travis standard

Install

npm install keyv-firestore

Usage

keyv-firestore uses nested collections for namespaces and keys. A root collection contains keys for each namespace, and each namespace key contains a single collection that holds key/value pairs. The path to a specific key is root-collection/namespace/namespace/key.

var Keyv = require('keyv')
var KeyvFirestore = require('keyv-firestore')

const keyv = new Keyv({
  store: KeyvFirestore,
  // REQUIRED: the project id to use
  projectId: 'my-firebase-project',
  // REQUIRED: the root collection to store things in
  collection: 'firestore-db-collection'
})

You can set the GOOGLE_APPLICATION_CREDENTIALS environment variable to configure credentials, or pass in a JavaScript object in the credentials option.

const keyv = new Keyv({
  store: KeyvFirestore,
  projectId: 'my-firebase-project',
  collection: 'firestore-db-collection',
  credentials: require('./path/to/google-credentials.json')
})

Tests

To be able to run tests locally, put a .google-credentials.json file in this repository's root directory.

License

Apache-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].