2021年3月13日星期六

Best way to structure array of data where each item can be separated into different parts?

I'm storing a list of recipe ingredients like this in Firestore:

enter image description here

Right now each array item is a String. It's occurred to me that if I eventually want to complete actions on the data, such as sum quantities of identical ingredients or convert units, I should separate each array item into its parts:

  1. Quantity (Int)
  2. Unit (String)
  3. Food item (String)

How can data that can be broken down in that way be structured in a database (using Firestore in my case)? Would I need an array for each part?

https://stackoverflow.com/questions/66620432/best-way-to-structure-array-of-data-where-each-item-can-be-separated-into-differ March 14, 2021 at 10:07AM

没有评论:

发表评论