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?
To add another array to the postImg
, you can:
const db = firebase.firestore();
const colRef = db.collection("user@domain.com");
const docRef = colRef.doc("1fJBcGT8DlZdgbl01LeX");
docRef.update({
postImg: firebase.firestore.FieldValue.arrayUnion("thenewurl");
})
Also see the Firebase documentation on adding items to an array .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.