Database design problems

Hi!
im working on designing my database. And got some issues with the structuring of it.

Here is how the structure is built up to now.
A main collection called “Database”

  • it will consist of several thousands of rows, but one column.
  • a name(text) for every row, like “apples”, “computers”, “icecream”, “wintertires”…and so on.

Then i create a collection for every row since all will be different collections.

  • ex. apples, computers, icecream…

i put a search field on the homescreen to search the database for something. ex. apples.
it looks like the examples below:

—————————————examples———————————
Apples(collection)

  • organic
  • conventional
    Apples organic(collection)
    • Gaia
    • Granny smith
      Apples conventional(collection)
    • pink lady
    • Rosedene

Computers(collection)

  • laptops
  • desktops
    Computers laptops(collection)
    • brand, cpu, harddrive, memory, weight, price
      Computers desktops(collection)
    • brand, cpu, harddrive, memory, price
      Computers monitor(collection)
    • brand, size, weight, price

Icecream(collection)

  • sorbet
  • frozen youghurt
  • gelato
    Icecream sorbet(collection)
    • flavor
      Icecream sorbet flavor(collection)
      • strawberry, vanilla, pear
        Icecream sorbet strawberry(collection)
        • brand, volume, price
          Icecream sorbet vanilla(collection)
        • brand, volume, price
          Icecream sorbet pear(collection)
        • brand, volume, price
          ……and so on.
          ————————————————————————

when i do a separate screen for the apples collection and for computers collection and for icecream collection as an example to make the database collection show the list composed to each collection. and then do a search the app just go to the first action link in the list to access.

Then since there are different row combination(text, pictures…) for different collections. i have to have separate lists for them.

In short i want to search from my database collection and from there link to all other collections connected
to the database collection. how do i do that?

(there will be pictures for some products att different lists, some collections will only have text, others will have text and pictures, some collections will have links to videos.)

Hi @Mag ,

To have a search function you need to flatten the database collections, so you can pick which levels are deep enough for all possible types of data, let’s say level 6, then you put all the data in this level even they only exist at level 1 in our mind, but all levels to the deepest should be created too.

To have faster search, there is a method called satellite collection, which is a copy of your collection but in minimal set, it is better to include id, so you let user search in this minimal set and when they want to go to detail, link to the original collection with that id.

Thank you very much Yongki!

1 Like