Firestore客户和发票,修订要求 [英] Firestore clients and invoices, amended requirement

查看:31
本文介绍了Firestore客户和发票,修订要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题是此处发布的问题的后续问题:

This question is a follow up question to the one posted here:

Firestore:客户端和发票,如何建模

我试图了解在Firebase/Firestore中对不断发展的需求进行建模背后的思考过程.

I am trying to understand the thought process behind modelling evolving requirements in Firebase/Firestore.

假设模型使用了可接受的答案,那么在发布应用程序后的2个月内,您将收到新的要求.现在需求说:我们需要获取姓为xyz的用户的发票详细信息(不仅是ID,还包括完整的详细信息).

Assuming the accepted answer was used for the model, then 2 months you get a new requirement after the app has been released. Now the requirement says: We need to get the invoice detail (not only id but the full details) for user whose last name is xyz.

假设数据库/应用程序已经运行了2个月(因此已经有数据),该如何建模.姓氏已经是用户详细信息的属性.

How can model this assuming the database/app has been live for 2 months (so there is data in there already). The last name is already an attribute of the user details.

谢谢

推荐答案

根据我们在此

According to the requirements that we see in this post, which I understand are mandatory in your project:

显示客户的发票

将系统中的所有发票更新为false

Update all invoices in the system to false

我可以向您推荐的最合适的模式是在每个 invoice 对象下方添加一个名为 userId 的新属性.

The most appropriate schema that can I recommend you, is the one in which you should add a new property called userId, beneath each invoice object.

因此,请考虑使用此技术,它实际上称为反向查找.这将帮助您更轻松地查询数据库,也将帮助您解决这两个问题.

So please consider using this tehnique, which is actually called a the reverse lookup. It will help you query your database more easily and will also help you solve both problems.

这篇关于Firestore客户和发票,修订要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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