Selectively assign db rows to the html elements

I have a grid displayed on a page where each “box” may or may not have an value assigned in the db. So when I’m rendering the page, I would like to selectively assign db rows where a db document exist for that specific “box”.

TAKEN ones have the db documents.

Example:

Can you explain the bit where the “TAKEN” boxes have documents assigned to them?
Do you want to have one database, with records that have a ‘take’ property which can either be true or false? If ‘taken’ is true, what data are you wanting to display?

One document per box. TAKEN was just an example. Value of the box will be from a document property so it will have an attribute called boxValue.

I’m not sure what you mean by:

selectively assign db rows where a db document exist for that specific “box”.

Do you want the grid to represent the whole collection, each box to represent each document in the collection, then get the value from the document and display it?

You can count how many records are in the collection, then use that to loop through its contents to create the box…

How familiar are you with javascript and meteor?

Yea eventually every box will be have a db document. I was trying to create the db documents lazily vs eagerly.

Eventually I’m trying to make the whole grid use meteor publish/subscribe.

A document in mongoDB is like a row in a database. Is that what you mean - or do you mean to create a unique collection (database) for each square?

I’m not really sure what you are trying to achieve, so it is hard to give advice:) What are you trying to make?

create a row for each square in boxes collection. Try to make tic-tac-toe game.

Have you done much in meteor yet? I would recommend looking at the meteor tips tutorial (http://meteortips.com/first-meteor-tutorial/) - it covers a lot of good ground which you will be able to use in a game like this…

well, you can just represent it as array of objects and than #each over them.
If you set in CSS for example 33.3% as width for each of them, u will get 3 per line.
Or you can also go with array of arrays if u find it easier to process and than something like

{{#each wholeArray}}
  {{#each this}}
    {{#if taken}}
      TAKEN
    {{else}}
      TAKE
    {{/if}}
  {{/each}}
{{/each}}