在测验应用程序中从 Firestore 检索好的答案以避免用户在回答问题之前知道好的答案的最佳方法是什么
What is the best way to retrieve good answer from Firestore in a Quiz app to avoid that a user know the good answer before answering to the question
我阅读了多篇 Stack Overflow 帖子,讲述了如何为测验应用程序存储数据。 他们说问题和好的答案不应该出现在同一个文档中,因为用户可以在回答问题之前知道好的答案。我想避免这种情况。 所以我把好的答案和问题放在单独的集合和文档中。
问题出在我的应用程序中,我什么时候可以检索问题的好答案以避免用户在点击答案之前就知道好答案?
- 我想到 当用户按下答案时,应用程序开始查询 Firestore 以检索问题的正确答案,一旦数据加载完毕,将其与用户答案进行比较。我害怕这个想法,因为当用户按下按钮时,他需要等待数据加载,我认为用户会很无聊。我没有看到其他解决方案。
我愿意接受任何建议。
这是我的 Firestore 数据架构:
I want to avoid that. So I put good answers and questions in separate collections and documents.
这不是个坏主意,但有点贵,因为 Firestore 中的所有内容都与您执行的读取和写入次数有关。
The problem is in my application, when can I retrieve the good answers for the questions to avoid users to know the good answer before they click on an answer?
您可以在显示问题时创建一个附加查询以获得正确答案。这样,你就会事先知道答案。但在我看来,将所有数据放在一个文档中更有意义。这样一来,你只需要支付一次阅读费用。
I fear this idea because when the user presses the button he will need to wait for the data to load and I think the user will be boring.
读取文档是一个异步操作。所以是的,你必须等待数据,但只要你读取小文件,读取操作应该非常快。
我阅读了多篇 Stack Overflow 帖子,讲述了如何为测验应用程序存储数据。 他们说问题和好的答案不应该出现在同一个文档中,因为用户可以在回答问题之前知道好的答案。我想避免这种情况。 所以我把好的答案和问题放在单独的集合和文档中。
问题出在我的应用程序中,我什么时候可以检索问题的好答案以避免用户在点击答案之前就知道好答案?
- 我想到 当用户按下答案时,应用程序开始查询 Firestore 以检索问题的正确答案,一旦数据加载完毕,将其与用户答案进行比较。我害怕这个想法,因为当用户按下按钮时,他需要等待数据加载,我认为用户会很无聊。我没有看到其他解决方案。 我愿意接受任何建议。
这是我的 Firestore 数据架构:
I want to avoid that. So I put good answers and questions in separate collections and documents.
这不是个坏主意,但有点贵,因为 Firestore 中的所有内容都与您执行的读取和写入次数有关。
The problem is in my application, when can I retrieve the good answers for the questions to avoid users to know the good answer before they click on an answer?
您可以在显示问题时创建一个附加查询以获得正确答案。这样,你就会事先知道答案。但在我看来,将所有数据放在一个文档中更有意义。这样一来,你只需要支付一次阅读费用。
I fear this idea because when the user presses the button he will need to wait for the data to load and I think the user will be boring.
读取文档是一个异步操作。所以是的,你必须等待数据,但只要你读取小文件,读取操作应该非常快。