2017-11-30 3 views

Antwort

0

Sie würden normalerweise das Admin SDK für Ihren Cloud Functions-Code verwenden. Sobald Sie das haben, ist es wichtig, die Sammlung wie gewohnt zu lesen. Überprüfen Sie die Knoten Beispiele im firebase documentation on reading all documents from a collection:

const admin = require('firebase-admin'); 

admin.initializeApp({ 
    credential: admin.credential.applicationDefault() 
}); 

var db = admin.firestore(); 

var citiesRef = db.collection('cities'); 
var allCities = citiesRef.get() 
    .then(snapshot => { 
     snapshot.forEach(doc => { 
      console.log(doc.id, '=>', doc.data()); 
     }); 
    }) 
    .catch(err => { 
     console.log('Error getting documents', err); 
    }); 
Verwandte Themen