1db.collection("cities").add({
2 name: "Tokyo",
3 country: "Japan"
4})
5.then(function(docRef) {
6 console.log("Document written with ID: ", docRef.id);
7})
8.catch(function(error) {
9 console.error("Error adding document: ", error);
10});
11
1function writeUserData(userId, name, email, imageUrl) {
2 firebase.database().ref('users/' + userId).set({
3 username: name,
4 email: email,
5 profile_picture : imageUrl
6 });
7}