Want to get only reviews that belongs to product being clicked


i have two collections and i want to show reviews only for product thats been clicked , but i am getting all reviews (from reviews collection) no matter what product i click.

Products = new Mongo.Collection("products");
Reviews = new Mongo.Collection("reviews");

for adding and reading reviews i have following code in router.js

   // Add new review
this.route('add_review', {
    data: function(){
        return Products.findOne(this.params._id)
// Read reviews
this.route('reviews', {
    data: function(){
            return Products.findOne(this.params._id)


'reviews': function () {
    return Reviews.find( )}

reviews.html (to read reviews )

<template name="reviews">
    <div class="row product-row">
        <div class="col-md-2">
            <img class="full" src="{{image}}">
        <div class="col-md-10">
{{#each reviews}}
    <p>{{body}} </p>
{{/each}}   </template>

You can see the entire code here GitHub repository


From what I see, you try to read all reviews. Not only the ones for a particular product.


yes that is what i am asking.Have tried different things still not working.So can you help how to do that you can see entire code on my GitHub Repository too.


you have gitignored .meteor/packages so I can’t even run you project :wink: fix it and I’ll take a look.


Haha, I had the same problem when I tried to clone this project.


Ah, btw. @soni1, provide some test data :smile:


And while you’re at it, there’s also no place with collection schemas which we could easily check to know what’s what. We have to guess your database schema from parts of code in different folders all over the project. That makes it a lot of research just to fix a simple thing. Though my guess is just the part I pasted previously where you should find by a product instead of finding all reviews.