0
I have a situation where there is the following business rule: when using the system to place an order it is possible to place a progressive discount that occurs by adding a variable number of percentages of discount that are applied successively.
That is, it is possible to inform in sequence, for example: 5, 10, 15, representing that first applies a discount of 5%, after 10% and finally of 15%.
Doing this in code is simple, but I’m having trouble persisting with this data. The problem here is that the number of discounts is arbitrary. For example: it is possible to inform 3 successive discounts, or 5, or even 10.
If there were a fixed number of discounts that are always applied it seems to me that it would be easy to save it in a relational database. Just create a table for discounts, one column for each discount.
In the case in point, I have considered NoSQL
because of the flexibility of not having to define a table. But I was a little bit in doubt, because from what little I know about it (I haven’t studied it thoroughly yet), it seems to me that it would be killing an ant with an atomic bomb. In addition, there are several different types of NoSQL
and I’m not sure which one would apply here.
Thus, what would be the most appropriate way to persist this type of data?