Answers for "firebase update array"

2

firestore update array

let washingtonRef = db.collection('cities').doc('DC');

// Atomically add a new region to the "regions" array field.
let arrUnion = washingtonRef.update({
  regions: admin.firestore.FieldValue.arrayUnion('greater_virginia')
});
// Atomically remove a region from the "regions" array field.
let arrRm = washingtonRef.update({
  regions: admin.firestore.FieldValue.arrayRemove('east_coast')
});
Posted by: Guest on June-05-2020
0

firestore update map

let initialData = {
  name: 'Frank',
  age: 12,
  favorites: {
    food: 'Pizza',
    color: 'Blue',
    subject: 'recess'
  }
};

let updateNested = db.collection('users').doc('Frank').update({
  age: 13,
  'favorites.color': 'Red'
});
Posted by: Guest on June-05-2020
0

document.set() firebasefirestore java

var washingtonRef = db.collection("cities").doc("DC");
// Atomically add a new region to the "regions" array field.
washingtonRef.update({
    regions: firebase.firestore.FieldValue.arrayUnion("greater_virginia")
});
// Atomically remove a region from the "regions" array field.
washingtonRef.update({
    regions: firebase.firestore.FieldValue.arrayRemove("east_coast")
});
Posted by: Guest on July-20-2020

Code answers related to "firebase update array"

Browse Popular Code Answers by Language