超过FireMB 1MB [英] 1MB exceed firestore

查看:54
本文介绍了超过FireMB 1MB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将旅行历史记录(数组映射)存储在Firestore上.尝试存储较大的数组映射(数组长度可能超过10,000)时,该应用程序崩溃了(Flutter应用程序).并且同一文档上有30多个字段.

I'm storing trip history (array-map) on firestore. the app is crash (Flutter app) when trying to store a large array map (array length may be more than 10,000). and also there are more than 30 fields on the same doc.

这是我的地图(地图列表).

this is my map(list of map).

  Map<String, dynamic> toMap() => {
        "latitude": latitude,
        "longitude": longitude,
        "accuracy": accuracy,
        "altitude": altitude,
        "speed": speed,
        "speed_accuracy": speedAccuracy,
        "heading": heading,
        "time": time,
      };

有什么解决方案可以将这种数组存储在Firestore上吗?

Is there any solution to store this kind of array on firestore?

推荐答案

在Firestore中,不能超过文档的最大大小.

It's not possible to exceed the max size of a document in Firestore.

您应该做的是将每一项数据拆分到自己的文档中,可能在嵌套在主文档下的子集合中.

What you should do instead is split each item of data into its own document, probably in a subcollection nested under a primary document.

这篇关于超过FireMB 1MB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆