Created
November 7, 2017 05:20
-
-
Save bmass02/bd9015d829ace9d0574a9d8f01fed9f2 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
<html> | |
<head> | |
<title>Testing Firestore</title> | |
</head> | |
<body> | |
<script src="https://www.gstatic.com/firebasejs/4.6.1/firebase.js"></script> | |
<script src="https://www.gstatic.com/firebasejs/4.6.1/firebase-firestore.js"></script> | |
<script> | |
// Initialize Firebase | |
var config = { | |
apiKey: "AIzaSyDLzB9l-EhojB4ibze5ryw5Sp-v36_ZElE", | |
authDomain: "testing-out-firestore.firebaseapp.com", | |
databaseURL: "https://testing-out-firestore.firebaseio.com", | |
projectId: "testing-out-firestore", | |
storageBucket: "testing-out-firestore.appspot.com", | |
messagingSenderId: "925460159146" | |
}; | |
firebase.initializeApp(config); | |
firebase.firestore().collection('collectionId').orderBy('index', 'desc').limit(2).onSnapshot((snapshot) => { | |
console.log(snapshot.size) | |
snapshot.docs.forEach((doc) => { | |
console.log(doc.data()) | |
}) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment