Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Post.findOne({
- "_id" : postId
- }, "_comments")
- .populate({
- path: "_comments",
- select: "ownerName content postDate commentType",
- options: { limit: commentCount, sort: { "postDate" : -1 } }
- })
- .exec(function(err, post) {
- if (err || !post) {
- jsonResponse.error = "There is some problem in DB";
- res.json(jsonResponse);
- }
- jsonResponse.content = post._comments;
- res.json(jsonResponse);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement