您好,我正在使用firebase,当我试图将一个(大)数据对象存储到数据库时遇到了一个错误。下面是我得到的确切错误:
ERROR Error: Uncaught (in promise): FirebaseError: [code=invalid-argument]: The value of property "values" is longer than 1048487 bytes.
这是因为firebase不允许存储大于1048487字节的字符串。(
documentation
).
有没有人经历过这种情况,并找到了一种方法来增加商店的限制?据我所知,购买一个计划似乎不能解决这个问题。
以下是我用来存储数据以满足其需要的代码:
storeSearchItem(searchItem, userID, data) {
this.db.collection('users').doc(userID).collection('searches').add({
searchTerm: searchItem.searchTerm,
searchDate: new Date().toString(),
values: data, //this values property is huge, a couple megabytes
});
}