meteor - Two Collections in one Each loop -


collection "notes" (markdown): meteor **amazing** , reactjs *learning next*

collection "links": google - www.google.com , stackoverflow - www.stackoverflow.com


i want display notes , links in 1 list sorted creation date:

1. google - www.google.com 2. meteor - amazing 3. reactjs - learning next 4. stackoverflow - www.stackoverflow.com 

and not that:

1. meteor - amazing 2. reactjs - learning next  1. google - www.google.com 2. stackoverflow - www.stackoverflow.com 

the "notes" , "links" collections have different structure:

notes = new mongo.collection('notes');   {{#each note}}       {filename}}       {{#markdown}} {{note}} {{/markdown}}   {{/each}}   links = new mongo.collection('links');   {{#each link}}       {filename}}       <a href={{link}}> {{link}} </a>   {{/each}} 

question: should have 1 collection both of them? there package this? or how can solve this?

if 1 item changed, item should rendered again.

  1. .fetch() documents , keys want each collection.
  2. .map() keys each array set of common keys
  3. you'll have 2 arrays common keys
  4. append 1 array other
  5. sort whole array key want sort by
  6. return array helper
  7. display in single template

alternatively can omit step 2 , keep each document in original structure template going have recognize kind of document rendering , display accordingly.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -