Skip to content

Instantly share code, notes, and snippets.

@markreale
Created May 28, 2019 12:24
Show Gist options
  • Save markreale/5716bf438a23645787fad7c61e7584cf to your computer and use it in GitHub Desktop.
Save markreale/5716bf438a23645787fad7c61e7584cf to your computer and use it in GitHub Desktop.
Firestore - Creating an entry (Document) with an auto-generated ID
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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment