问题描述
我曾尝试使用 Vue.js 在 Firestore 中更新文档,但每当我尝试在新文档中设置新文件时都会出现以下错误。
Function DocumentReference.set() called with invalid data. Data must be an object,but it was: a custom Object object
我尝试使用 merge
选项设置新字段。此外,我还在 Stackoverflow 上检查了其他类似问题,但没有任何解决方案适合我。
代码:
const ref = this.$fireStore.collection('myDocs').doc(id);
const doc = await ref.get();
if (!doc.exists) {
return;
}
await ref.set({ test: true },{ merge: true });
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)