Trying to create a blog website where users can comment on posts. I was able to create different blog posts so now I am trying to implement the comment feature. In my routes/admin/comments.js file I was able to create a comments array and append each comment into the array. I am using EJS to try to display the comments which should be <%=comments%> but I am getting an error that says 'comments is not defined' even though I have defined it.I am looking at my MongoDB and there are two collections, 'comments' and 'posts'. Within the 'posts' collection, it has an array called 'comments' and it has the objectID's of the comments. Please could someone tell me what the issue is? I seriosuly cannot see what the problem with my code is! Thankscomments.js https://pastebin.com/GLyw5Th0Post.js Schema https://pastebin.com/fY4mrVBdComment.js Schema https://pastebin.com/MMEZMZqi
Submitted August 20, 2020 at 02:04AM by PAB_ESCOBAR
No comments:
Post a Comment