on create document in firebase code example
Example: document.set() firebasefirestore java
// Create an initial document to update.var frankDocRef = db.collection("users").doc("frank");frankDocRef.set({ name: "Frank", favorites: { food: "Pizza", color: "Blue", subject: "recess" }, age: 12});// To update age and favorite color:db.collection("users").doc("frank").update({ "age": 13, "favorites.color": "Red"});