我正在尝试更新我的firestore中的数组,我遵循了谷歌(https://firebase.google.com/docs/firestore/manage-data/add-data)提供的文档,但它不起作用,我还检查了一下,以确保我有最新版本的firebase npm模块。
下面是我的代码:
> db
.collection('Data')
.doc('One')
.collection('Doc')
.doc(this.$route.params.id.toLowerCase())
.update({
myArr: firebase.firestore.FieldValue.arrayUnion(
'test'
),
})
.then(() => console.log('Successfully written'))
.catch(err => console.log(err));
发布于 2018-08-31 01:23:12
Firebase npm模块已过期。必须手动重新安装
发布于 2019-01-16 00:37:20
这已经作为@google-cloud/firestore v0.16.0的一部分发布了。它还不能通过Firebase Admin获得,但很快就会发布。注意,函数名是admin.firestore.FieldValue.arrayUnion()
。ttps://github.com/firebase/firebase-admin-node/issues/323
发布于 2018-10-19 12:49:17
"firebase-admin":"^6.0.0",是添加arrayUnion
的版本。升级npm包。
检查https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/CHANGELOG.md#060
https://stackoverflow.com/questions/52033157
复制相似问题