[英]Add a new image with the existing image list in firestore database
I have already two images in the firestore database, I am trying to add a new image to this list?我已经在 firestore 数据库中有两张图片,我正在尝试将新图片添加到此列表中? How can I add a new image to the existing image list?
如何将新图像添加到现有图像列表?
To add another array to the postImg
, you can:要将另一个数组添加到
postImg
,您可以:
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 .另请参阅 Firebase 文档,了解将项目添加到数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.