reddit-api-clone-2 icon indicating copy to clipboard operation
reddit-api-clone-2 copied to clipboard

Requesting post-tutorial repository

Open wfsaxton opened this issue 8 years ago • 1 comments

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"
}

wfsaxton avatar Nov 01 '17 21:11 wfsaxton

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.

wfsaxton avatar Nov 02 '17 00:11 wfsaxton