Skip to content

Instantly share code, notes, and snippets.

@Chizaram-Igolo
Created July 30, 2021 13:32
Show Gist options
  • Save Chizaram-Igolo/aa6788de4ef94156ea5495e27231012b to your computer and use it in GitHub Desktop.
Save Chizaram-Igolo/aa6788de4ef94156ea5495e27231012b to your computer and use it in GitHub Desktop.
// Add a first document with a generated ID.
db.collection("users").add({
first: "Ada",
last: "Lovelace",
born: 1815
})
.then((docRef) => {
console.log("Document written with ID: ", docRef.id);
})
.catch((error) => {
console.error("Error adding document: ", error);
});
// Add a second document with a generated ID.
db.collection("users").add({
first: "Alan",
middle: "Mathison",
last: "Turing",
born: 1912
})
.then((docRef) => {
console.log("Document written with ID: ", docRef.id);
})
.catch((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