firebase.firestore.FieldValue.arrayUnion 不是函数

kum*_*ail 6 javascript firebase google-cloud-firestore

我正在尝试更新我的 Firestore 中的数组,我按照 Google 提供的文档(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));
Run Code Online (Sandbox Code Playgroud)

kum*_*ail 5

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