Skip to content

Commit 66a0582

Browse files
authored
Show empty snapshot detection
Fixes #22
1 parent fbe0999 commit 66a0582

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

firestore/main/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,11 @@ function getMultiple(db) {
560560
var citiesRef = db.collection('cities');
561561
var query = citiesRef.where('capital', '==', true).get()
562562
.then(snapshot => {
563+
if (snapshot.empty) {
564+
console.log('No matching documents.');
565+
return;
566+
}
567+
563568
snapshot.forEach(doc => {
564569
console.log(doc.id, '=>', doc.data());
565570
});

0 commit comments

Comments
 (0)