Add a new image with the existing image list in firestore database

Tags: , , , ,

I have already two images in the firestore database, I am trying to add a new image to this list? How can I add a new image to the existing image list?

Firebase collection


To add another array to the postImg, you can:

const db = firebase.firestore();
const colRef = db.collection("");
const docRef = colRef.doc("1fJBcGT8DlZdgbl01LeX");
  postImg: firebase.firestore.FieldValue.arrayUnion("thenewurl");

Also see the Firebase documentation on adding items to an array.

Source: stackoverflow