【发布时间】:2019-12-24 19:55:07
【问题描述】:
我正在尝试将很长的字符串插入到 firebase firestore 我收到此错误消息
Exception has occurred.
PlatformException (PlatformException(Error performing setData,
INVALID_ARGUMENT: The value of property "json" is longer than 1048487 bytes., null))
我的代码是:
Future<void> addREportToDB(String addedCount, String deletCount, String updatedCount, String json) {
// Map decodedCloud = jsonDecode(json);
return Firestore.instance.collection("reports").add({
"dateCreate": new DateTime.now(),
"addedCount": addedCount,
"deletCount": deletCount,
"updatedCount": updatedCount,
"json": json,
// "json":decodedCloud,
}).then((doc) {
print(doc.documentID.toString());
});
}
和 (json) 变量这是我从另一个 API 获得的文本,该文本包含 600 多名员工的数据,格式为 JSON 字符串 我只需要保存它
任何帮助将不胜感激
【问题讨论】:
-
如果您正在获取 json 数据,为什么不将其分解为独立的 json 样式文档。甚至可能将每个元素放入一个数组中。迭代 600 多个元素并单独处理它们而不是仅仅将它们全部存储在一个节点(字段)中应该不是什么大问题。
标签: json firebase flutter dart google-cloud-firestore