Firestore 中数组的存储大小限制是什么? [英] What is storage size limitation of an array in Firestore?

查看:20
本文介绍了Firestore 中数组的存储大小限制是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 Firestore 中数组的存储大小限制是什么.我想在数组中创建数百万个索引,并希望将数据存储为 JSON 对象.数组将如下所示:

I want to know what is storage size limitation of an array in Firestore. I want to create millions of index in array and want to store data as a JSON object. Array will look like:

   [{id:1,name:'shakti',userdata:2122},
   {id:0.55,name:'shakti',userdata:2122},
   {id:1.58,name:'shakti',userdata:2122},
   {id:2.58,name:'shakti',userdata:2122},
   {id:1.5,name:'shakti',userdata:2122}];

我浏览了文档,但没有在那里获得任何适当的指南.

I went through the documentation but did not get any proper guide there.

推荐答案

对于 Android,有一个名为 FirestoreDocument-Android,这将帮助您检查最大 1 MiB(1,048,576 字节)配额.

For Android, there is a library named FirestoreDocument-Android, that will help you to check against the maximum of 1 MiB (1,048,576 bytes) quota.

对于 Firestore 阵列没有具体限制.限制出现在文档的情况下,因为在 Firestore 中文档有限制.因此,当涉及到可以放入文档的数据量时,存在一些限制.根据关于使用和限制的官方文档:

There is no specific limitation when it comes to Firestore arrays. The limitation comes in case of documents because in Firestore the documents have limits. So there are some limits when it comes to how much data you can put into a document. According to the official documentation regarding usage and limits:

文档的最大大小:1 MiB(1,048,576 字节)

Maximum size for a document: 1 MiB (1,048,576 bytes)

如您所见,单个文档中的数据总量限制为 1 MiB.当我们谈论存储文本时,您可以存储很多内容,但随着数组变大,请注意此限制.

As you can see, you are limited to 1 MiB total of data in a single document. When we are talking about storing text, you can store pretty much but as your array getts bigger, be careful about this limitation.

所以,只要你在这个限制内存储数据,就不会有问题.如果您认为自己可能会克服此限制,我建议您将该数据存储在集合中.在这种情况下,没有任何限制.您可以根据需要存储任意数量的文档.

So, as long as you store data within this limitation, there will be no problem. If you think that you might get over this limitation, I recommend you to store that data in a collection. In this case there are no limitations. You can store as many documents as you want.

这篇关于Firestore 中数组的存储大小限制是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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