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.
.fetch()documents , keys want each collection..map()keys each array set of common keys- you'll have 2 arrays common keys
- append 1 array other
- sort whole array key want sort by
- return array helper
- 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
Post a Comment