How to use the @google-cloud/firestore function in @google-cloud/firestore

To help you get started, we’ve selected a few @google-cloud/firestore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IanMitchell / aquarius / src / lib / database / index.js View on Github external
const database = (() => {
  log('Connecting to Firebase...');

  try {
    const firestore = new Firestore({
      projectId: process.env.FIREBASE_PROJECT,
      keyFilename: path.join(
        __dirname,
        `../../../${process.env.FIREBASE_KEYFILE}`
      ),
    });

    const methods = Object.create(null);

    // Inspired my Mongoist
    return new Proxy(firestore, {
      get: (obj, prop) => {
        const fbProp = obj[prop];

        // Cache, lazily
        if (typeof fbProp === 'function') {
github Limetric / OpenRCT2.org / src / misc / firestore.js View on Github external
import Firestore from '@google-cloud/firestore';
import Config from '../config';
const firestoreConfig = Config.cloud['firestore'];

const db = new Firestore({
    projectId: firestoreConfig['projectId'],
    keyFilename: firestoreConfig['keyFilename'],
});

export default db;