Created
January 14, 2018 04:58
-
-
Save shangyilim/71b7577c7079f09c0a1e1b8bf6b1ee21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve cities from California | |
db.collection("cities").where("state", "==", "CA") | |
.onSnapshot(function(querySnapshot) { | |
querySnapshot.forEach(function(doc) { | |
// binded to the UI | |
allItems.push(doc.data().name); | |
}); | |
}); | |
// Retrieve cities from Colorado | |
db.collection("cities").where("state", "==", "CO") | |
.onSnapshot(function(querySnapshot) { | |
var cities = []; | |
querySnapshot.forEach(function(doc) { | |
// binded to the UI | |
allItems.push(cities); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment