How to design database schema for meteor/mondodb for this situation?


#1

I don’t know how the collection for a meteor app should be. In MySQL I would have 3 tables:

  • table_1: id, column_a, column_b
  • table_2: id, table_1_id, column_c, column_d
  • table_3: id, column_e, column_f

table_2 and table_3 could have the same indentical rows. Some information can pe in both tables, in table_2 and not in table_3, in table_3 and not in table_2.

I know that in meteor/mongodb when you design database schema, you need to know how you will access/display the information. I want to display something like this:

  • table_1.column_a
  • show all rows from table2 where table_2.table_1_id=table_1.id; and I
    also want to check if table_2.column_c=table_3.column_e, if it’s true
    than I want to display that row from table_3.

I hope did you understand, also if you have some suggestions about subscriptions/publications whould be much aprecieted.

P.S. I am sorry for the title of this topic, but I couldn’t find a more specific title.


#2

Your example is a bit too abstract.

it sounds like table1 is a collection… but I’m not sure what the intention of table2 and table 3 is.


#3

Explaining it above I better understand the problem.

What I want is like a list of products(list A) that every products have a list of specifications. And I will like to have another list(list B), where I have a list of specification with more details.
And I want to display the product details, inclusiv his list of specifications, and when it displays the specifications of products I want to search in list B to find If there is an similar item, to show his full descriptions.
I want to make that search when it’s displaying because, I want to be able to add the specification details(list B) later and this list will be updated periodically.
The list A(title, and another 3-4 columns) would have ten of thousands of product, the list of specification(title) of product in list A would have 10-20 items, and list B(title, description, status) would have a few houndred.

I have an ideea to create a collection of list A and for every product in there add an array with the specifications, and another collection for list B. I would subscribe/publish the whole collection of list B, and when I display the list A, search for every specification in list B. I don’t know how good it is.


#4

so why not a products collection
and a specifications collection, in the specification you have { product_id: , summary: {}, detailed: {}}


#5

or put the spec on the product?