Ejemplo 1: Firestore establece un documento
let data = {
name: 'Los Angeles',
state: 'CA',
country: 'USA'
};
// Add a new document in collection "cities" with ID 'LA'
let setDoc = db.collection('cities').doc('LA').set(data);
Ejemplo 2: 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"});
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)