首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >firebase.firestore.FieldValue.arrayUnion不是函数

firebase.firestore.FieldValue.arrayUnion不是函数
EN

Stack Overflow用户
提问于 2018-08-27 13:44:11
回答 4查看 8.3K关注 0票数 7

我正在尝试更新我的firestore中的数组,我遵循了谷歌(https://firebase.google.com/docs/firestore/manage-data/add-data)提供的文档,但它不起作用,我还检查了一下,以确保我有最新版本的firebase npm模块。

下面是我的代码:

代码语言:javascript
运行
复制
> 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));
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2018-08-31 01:23:12

Firebase npm模块已过期。必须手动重新安装

票数 4
EN

Stack Overflow用户

发布于 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

票数 4
EN

Stack Overflow用户

发布于 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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52033157

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档