react firebase add doc to collection 1

react firebase add doc to collection

firebase
  .firestore()
  .collection("Users")
  .doc("mydoc")
  .collection("Activities")
  .doc("Database")
  .set({
    key: "1",
    value: "",
  })
  .then((ref) => { console.log(ref) });

Here is what the above code is Doing:
1. It’s creating a new collection called “Users”
2. It’s creating a new document called “mydoc”
3. It’s creating a new collection called “Activities”
4. It’s creating a new document called “Database”
5. It’s setting the key and value of the document “Database”

Similar Posts