我正在为Firebase中的文档建立工厂,以后必须由另一个文档引用。列表将这些条目存储在引用数组中。
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: Function DocumentReference.update() called with invalid data. Unsupported field value: a custom bI object (found in field entries)
我认为也许是出于某种原因而被参考引用所吸引,但是即使我将entry.id
传递给arrayUnion
方法,它也会产生相同的错误。我检查了arrayUnion的文档,这似乎与预期的一样-我在这里错过了什么?
Firebase JS SDK版本7.14.2
答案 0 :(得分:0)
这似乎可以通过将导入从firebase/firebase
更改为firebase/app
来解决-该类型在两者中均有效,但是只有firebase/app
返回正确的数据结构。