Advertisement
Guest User

Untitled

a guest
May 24th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Post.findOne({
  2. "_id" : postId
  3. }, "_comments")
  4. .populate({
  5. path: "_comments",
  6. select: "ownerName content postDate commentType",
  7. options: { limit: commentCount, sort: { "postDate" : -1 } }
  8. })
  9. .exec(function(err, post) {
  10. if (err || !post) {
  11. jsonResponse.error = "There is some problem in DB";
  12. res.json(jsonResponse);
  13. }
  14.  
  15. jsonResponse.content = post._comments;
  16. res.json(jsonResponse);
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement