Hello,
I am trying display the unique profile of a babysitter (i.e: babysitter username, city, postal code, etc … ) from a schema/collection called “Babysitters” .
The URL correctly contains the babysitter unique _id, say:
http://localhost:3000/test/PqMviBpYAmTA2b5ec
but I don’t manage to retrieve all the other fields.
The MongoDB is queried in two files: routes.js and the template test.js
1) in routes.js
Router.route(‘/test/:_id’, {
name: ‘test’,
data: function () {
return Babysitters.findOne({ _id: this.params._id });
}
});
2) in test.js
Template.test.helpers({
data: function () {
//sitterusername = this.params.sitterusername;
//console.log(this.params._id );
return Babysitters.findOne( { _id: this.params._id });
}
});
the html file: test.html:
< template name=“test” >
{{#with data}}
< ul >
< li >< img src=“/” {{photourl}} height=“100” width=“100” >< /li >
< li >Babysitter username: {{ sitterusername }}< /li >
< li >Presentation: {{ presentation }}< /li >
< li >City: {{ city }}< /li >
< li >Postal Code: {{ postalcode }}< /li >
< li >Mother tongue: {{ mothertongue }}< /li >
< li >Languages spoken {{ languagesspoken }}< /li >
< li >Experience {{ experience }}< /li >
< li >Homework help: {{ homeworkhelpavailable }}< /li >
< li >Hourly wages: {{ hourlywages }} €/h< /li >
< /ul >
{{ /with }}
< /template >
Thanks for your time and suggestions, I am just a meteor newbie.
Kâmi