Currently, I am working with Meteor and am facing a challenge in accessing values stored within a field that operates as an internal array.
After executing the query (with projection), I receive a single record structured like this:
{ "comments" : [ { "uid" : "1", "un" : "Sarah", "c" : "cc" }, { "uid" : "2", "un" : "Leo", "c" : "dd" } ] }
My objective is to display both the "un" and "c" for each entry in the array within a template. I attempted the following:
Html:
<template name="allComments">
<ul>
{{#each allC}}
<li>{{un}}</li>
{{/each}}
</ul>
</template>
JavaScript:
Template.allComments.allC = function () {
//query that returns result described above
}
I've experimented with {{#with}}
, nested {{#each}}
, and nested templates without success...
Could someone provide guidance on how to access these values effectively?
Your help is greatly appreciated. Thank you, Sarah.