mongodb - Meteor / Iron Router: Data from Mongo db collection don't show up in dynamic template page -


i'm quite new in javascript programing, appreciate help.

i'm using:

meteor (official windows port) latest version 1.1.0.2 iron router , autopublish package

what i'm trying do, shouldn't hard do, missing me. want load data mongo db collection

movies = new mongo.collection('movies'); 

into template in /client folder

<template name="movie_template">   <p>dynamic page test movieid {{id}}</p>   <h1>{{name}}</h1>   <p>{{year}}</p> </template> 

my router.js file based in /lib folder in root of meteor project

router.route('/movies/:movieid', function() { this.render('movie_template', {     waiton: function() {         return meteor.subscribe('moviesdetails', this.params.movieid);     },     data: function() {         return movies.findone({id: this.params.movieid});     }   }); }); 

publications.js in /server folder

meteor.publish('moviedetails', function(movieid) {   check(movieid, number);   return movies.find({id: movieid}); }); 

only 1 thing paragraph text without id. i'm doing wrong?

side question: have use publish() function while i'm using autopublish package? in case use movies.find() instead subscribe()?

note: movie object field keys.

{_id, id, name, year} 

@below9k correct , should using _id rather id.

to answer side question, autopublish package not necessary either meteor.publish , meteor.subscribe


Popular posts from this blog