Skip to content

Commit

Permalink
populate likes and users
Browse files Browse the repository at this point in the history
  • Loading branch information
Billions94 committed Nov 21, 2021
1 parent 228a274 commit a402048
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/APIs/posts/p-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const getAllPosts = async (req, res, next) => {
.sort(mongoQuery.options.sort)
.populate({ path: 'user'})
.populate({ path: 'comments'})
.populate({ path: 'likes', select: 'name surname'})

res.send({
links: mongoQuery.links('/posts', total),
Expand Down
1 change: 1 addition & 0 deletions src/APIs/users/u-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const getAllUsers = async (req, res, next) => {
.skip(mongoQuery.options.skip)
.sort(mongoQuery.options.sort)
.populate({ path: 'experiences'})
.populate({ path: 'friends', select: 'name surname email'})

res.send({
links: mongoQuery.links('/users', total),
Expand Down

0 comments on commit a402048

Please sign in to comment.