How can I save additional user data in Cloud Firestore database? I mean, which one is the proper way? I want to create a user collection, where I can store their username an
Yes this is the correct way, you will have a collection called Users inside that collection there will be a document which is this doc(username) and has the value id: userid
You can also save the userid as an object, and inside that object you will have values related to that useruid
like this example:
var frankDocRef = db.collection("users").doc("frank");
frankDocRef.set({
name: "Frank",
favorites: { food: "Pizza", color: "Blue", subject: "recess" },
age: 12
});
https://firebase.google.com/docs/firestore/manage-data/add-data#update_fields_in_nested_objects