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
db.collection("[YOUR_COLLECTION]").onSnapshot(function(querySnapshot){ | |
// Things to do whenever the Firestore database Snapshot updates | |
}); |
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
db.collection("[YOUR_COLLECTION]").doc("[YOUR_DOCUMENT]").delete().then(function() { | |
console.log("Document successfully deleted!"); | |
}).catch(function(error) { | |
console.error("Error removing document: ", error); | |
}); |
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
db.collection("[YOUR_COLLECTION]").add({ | |
[YOUR_PROPERTY]: "[YOUR_UPDATED_VALUE]" | |
}) | |
.then(function(docRef) { | |
console.log("Document written with ID: ", docRef.id); | |
}) | |
.catch(function(error) { | |
console.error("Error adding document: ", error); | |
}); |
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
db.collection("[YOUR_COLLECTION]").doc("[YOUR_DOCUMENT]").set({ | |
[YOUR_PROPERTY]: "[YOUR_UPDATED_VALUE]" | |
}) | |
.then(function() { | |
console.log("Document successfully written!"); | |
}) | |
.catch(function(error) { | |
console.error("Error writing document: ", error); | |
}); |
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
return db.collection("[YOUR_COLLECTION]").doc("[YOUR_DOCUMENT]").update({ | |
[YOUR_PROPERTY]: "[YOUR_UPDATED_VALUE]" | |
}) | |
.then(function() { | |
console.log("Document successfully updated!"); | |
}) | |
.catch(function(error) { | |
console.error("Error updating document: ", error); | |
}); |
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
db.collection("things").get().then((querySnapshot) => { | |
querySnapshot.forEach((doc) => { | |
// Code for handling each entry returned from the database | |
// ID for each Document in the Collection can be referenced with: doc.id | |
// Data for each Document in the Collection can be referenced with: doc.data() | |
}); |
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
<!-- | |
Access the Firebase tools you need | |
We are using the CDN here | |
You can change the version number (6.0.4) to whatever the latest version of Firebase is | |
You can put this content in the <head> of your HTML file, or just before the closing </body> tag - | |
- there is arguments for both approaches | |
--> | |
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-app.js"></script> | |
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-firestore.js"></script> | |
<script> |
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
<!doctype html> | |
<html> | |
<head> | |
<!-- Tell your browser where the CSS Style sheet for this web page is --> | |
<link rel="stylesheet" href="style.css" /> | |
</head> | |
<body> | |
<!-- Inside the <body> tag will be the content that appears in your browser window --> | |
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
<!doctype html> | |
<html> | |
<head> | |
<!-- Inside the <head> tag will be content about your web page, or links to other resources. --> | |
</head> | |
<body> | |
<!-- Inside the <body> tag will be the content that appears in your browser window --> | |
</body> |
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
<meta property="og:title" content="This is the title of your page" /> | |
<meta property="og:type" content="article" /> | |
<meta property="og:url" content="http://yoursite.com/" /> | |
<meta property="og:image" content="http://www.theymc.com/wp-content/themes/theymc/assets/images/ymc_logo_374.png" /> | |
<meta property="fb:admins" content="000000009" /> |
NewerOlder