QuizApp-Firebase/FireStore读取 [英] QuizApp - Firebase/ FireStore Reads

查看:120
本文介绍了QuizApp-Firebase/FireStore读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Android Studio和Firebase进行在线QuizGame.第一步将是一个玩家的游戏模式,在该模式下他从服务器获取问题.代码本身不是什么大问题,但是我对Firestore的读取/定价有疑问.

I want to make an online QuizGame using Android Studio and Firebase. First step will be a game mode for one Player where he gets Questions from the server. The code itself is not a big problem but I have a question about the reads/pricing of Firestore.

游戏玩法如下:一轮,五个问题.我想使数据库看起来像这样:

The gameplay will look like this: One Round, 5 questions. I want to make a Database looking like this:

项目:类别(集合)-> generateID(文档)->自定义对象(我的自定义对象具有问题,正确答案A,答案B,C和D的数组列表).

Project: Category(Collection) -> generatedID(Document) -> custom Object (My custom Object has an Arraylist of Question, Correct AnswerA, AnswerB, C and D).

我的一般问题是,让我说我正在寻找一个ID.例如,我的类别集中有50个ID.如果我开始查询,它将检查每个条目是否保存的ID ==我的搜索ID.总共是50次阅读还是只有一次?

My general question is, lets say I am looking for an ID. I have for example 50 IDs in my Category Collection. If I start a query it will check every entry if the saved ID == my searched ID. Will that be a total of 50 reads or only one?

推荐答案

Firestore的定价基于文档的读取,写入和删除.如果运行查询,将向该查询收取该查询返回的所有文档的费用,而不是集合中文档的总数.如果需要返回大型数据集,则可以通过使用游标和分页来避免不必要的开销.如果您只搜索一个ID,则很可能只会返回一个文档,因此,只需花一读即可.

Firestore pricing is based on document reads, writes and deletes. If you run a query, you will be charged for any documents returned by that query, not the total number of documents in the collection. You can avoid un-necessary cost by the use of cursors and pagination, if you need to return large datasets. If you are only searching for a single ID, then it is likely that'll only return one document and, therefore, it'll only cost you for one document read.

如果查询未返回任何结果,则将为您收取一份文档的费用.

If your query returns no results, you will be charged for one document read.

您可以从 Cloud Firestore定价页中获取更多详细信息

You can get more details from the Cloud Firestore pricing page

这篇关于QuizApp-Firebase/FireStore读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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