fixed sorting function

This commit is contained in:
ak 2023-09-28 14:28:18 -07:00
parent ad5123f10a
commit b27395697b

View file

@ -97,8 +97,7 @@ exports.get = asyncHandler(async (req, res, next) => {
const dbPost = await Post.findById(req.params.postID).lean().exec(); const dbPost = await Post.findById(req.params.postID).lean().exec();
const comments = await Comment.find({ post: dbPost._id }) const comments = await Comment.find({ post: dbPost._id })
.sort({ .sort({
field: "date", date: -1,
desc,
}) })
.lean() .lean()
.exec(); .exec();