Q: Node.js blog post add comment not working When I add a comment to any blog post it doesn't work. This is a normal Node.js MVC controller which is linked to route:
    commentBlog(req, res) {

      const comment = {
        comment: req.body.comment,
        author: req.params.id
      }

      Comment.create(comment, (error, comment) =>  {
        if (error) {
          console.log(error);
        } else {
          Blog.findById(req.params.id, (error, blog) => {
            blog.comments.push(comment);
            console.log(comment);
            blog.save((error, savedBlog) => {
              if (error) {
                console.log(error);
              } else{
              res.redirect('/blogs/' + blog._id);
            }
        })
         })
        }
      })
      };


(  this is the model )
    --------------------
    const mongoose     = require('mongoose'),
          Schema       = mongoose.Schema;
var commentSchema = new Schema({
    author: { type: Schema.Types.ObjectId, ref: 'user' },
    comment: {type: String},
    created: {type: Date, default: Date.now},
    blog: { type: Schema.Types.ObjectId, ref: 'blog' }
});

var Comment = mongoose.model('comment', commentSchema);

module.exports = Comment;


this is the ejs file
---------------------
<body>

 <% if(blog) { %>

<form action="/blogs/<%= blog._id %>/comment" method="POST">
    <textarea name="comment[text]"
        rows="10" cols="50">Write something here
    </textarea>
    <input type="submit" value="Post comment">
    </form>
 <% } %>

 
**i don't know why it doesn't display when i add like to any post it just 

    don't work**

A: Well, you were not displaying the blog content in your ejs file. Only rendering the form. You should render the blog fields for them to display. Below is an example to show the blog title( provided there is a title field in the blog object).  
    <body>

     <% if(blog) { %>
    <h2><%= blog.title %> </h2>

    <form action="/blogs/<%= blog._id %>/comment" method="POST">
        <textarea name="comment[text]"
            rows="10" cols="50">Write something here
        </textarea>
        <input type="submit" value="Post comment">
        </form>
<% } %>

You can then display the other fields in your blog object using the example above.
