Skip to content

Instantly share code, notes, and snippets.

@shangyilim
Created January 14, 2018 04:58
Show Gist options
  • Save shangyilim/71b7577c7079f09c0a1e1b8bf6b1ee21 to your computer and use it in GitHub Desktop.
Save shangyilim/71b7577c7079f09c0a1e1b8bf6b1ee21 to your computer and use it in GitHub Desktop.
// 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