Firebase:arrayUnion导致DocumentReference.update失败
我正在为Firebase中的一个文档构建一个工厂,该文档以后必须被另一个文档引用。该列表将这些条目存储在引用数组中Firebase:arrayUnion导致DocumentReference.update失败,firebase,google-cloud-firestore,Firebase,Google Cloud Firestore,我正在为Firebase中的一个文档构建一个工厂,该文档以后必须被另一个文档引用。该列表将这些条目存储在引用数组中 import firebase from 'firebase/firebase'; //... let listDoc = db.collection('lists').doc(listId) db.collection('entries').add({ ... }) .then(entry => { listDoc.update({ entrie
import firebase from 'firebase/firebase';
//...
let listDoc = db.collection('lists').doc(listId)
db.collection('entries').add({ ... })
.then(entry => {
listDoc.update({
entries: firebase.firestore.FieldValue.arrayUnion(entry)
})
});
由于以下原因,此操作失败:FirebaseError:使用无效数据调用函数DocumentReference.update()。不支持的字段值:自定义bI对象(在字段条目中找到)
我认为它可能因为某种原因被引用捕获,但即使我将entry.id
传递给arrayUnion
方法,它也会产生相同的错误。我已经检查了arrayUnion的文档,这一切似乎与预期的一样——我在这里遗漏了什么
Firebase JS SDK版本
7.14.2
这似乎可以通过将导入从Firebase/Firebase
更改为Firebase/app
来解决-该类型在这两种情况下均有效,但只有firebase/app
返回正确的数据结构。这似乎可以通过将导入从firebase/firebase
更改为firebase/app
来解决-该类型在这两种情况下都有效,但只有firebase/app
返回正确的数据结构