I can’t read in Firestore with cloud functions using javascript

Asked

Viewed 17 times

0

Hello person I am breaking my head to know what is missing to make a reading in a collection in the Firestore using cloud functions. follows my code below.

const functions = require('firebase-functions');
const admin = require('firebase-admin'); 
var serviceAccount = require("./serviceAccountKey.json");

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "https://muralnews-2019.firebaseio.com"
});

const db = admin.firestore();

código que estou tentando fazer a leitura, é bem simples.

db.collection('solicitacao').get()
      .then(snapshot => {
        if(snapshot.exists){
         response.send("Docs encontrado!");
        }else{
          response.send("No docs found!");
        }
       });

always shows that there is no data.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.