Displaying elements from two different collections in meteor -
i have 2 different meteor collections, 1 file collection store images:
images = new fs.collection("images", { stores: [new fs.store.filesystem("images", {path: "~/uploads"})] }); and other collection store information these images:
photos = new mongo.collection("photos"); photos.attachschema(new simpleschema({ userid:{ type: string, autovalue:function(){return this.userid}, }, username:{ type: string, autovalue:function(){return meteor.users.findone({_id: this.userid}).username}, }, groupmembers: { type: string }, comments: { type: string, autoform:{ rows: 5 } }, fileid: { type: string } })); i built helper function display data on template:
template.imagessubmitted.helpers({ photos: photos.find(), image: function(){images.findone({_id: template.instance().data.image}).url(); } }); images.allow({ download: function () { return true; }, fetch: null }); and here html code display images , information photos:
</template> <template name = "imagessubmitted"> list of photos {{#each photos}} <div class = "uploadedimage"> image {{> photo}} <img src="{{this.image}}" class = "tableimage" alt="thumbnail"> </div> {{/each}} </template> unfortunately, page doesn't display either database. images display alternate "thumbnail" , {{>photo}} doesn't seem display information photos collection.
is there way fix this? there way streamline i'm using 1 collection , still able use cfs:autoform create , publish form collects images?
did tried using query in browser console? photos.find().fetch(); , defining photo template?
Comments
Post a Comment