reddit-api-clone-2
reddit-api-clone-2 copied to clipboard
Requesting post-tutorial repository
Really appreciate your youtube tutorials for reddit api clone 1 and 2. Is it possible up create a repository for the end result of clone 2?
Reason I'm asking is because I'm stuck on the VERY last portion of the tutorial and I can't see what is wrong with my code from the youtube video. Basically, when I put this in my postController.getAll function:
.populate({
path: '_comments',
select: 'text'
})
I get this error (from err.toString()):
{
"message": "TypeError: Cannot read property 'populate' of undefined"
}
I solved the issue (via the youtube comments) by removing the autoPopulateCreator pre-hook from Comments.js:
// const autoPopulateCreator = (next) => {
// this.populate({
// path: '_creator',
// select: 'username createdAt -_id'
// });
// next();
// };
// commentSchema.pre('find', autoPopulateCreator);
Still, great tutorial and, again, would be great to have a repo with the final product.