【发布时间】:2019-07-23 08:00:27
【问题描述】:
我正在尝试使用猫鼬根据日期值对我的收藏进行排序。当我使用排序功能时,它无法按预期工作。
以下是我使用的查询。
const filters = {};
filters.spacecategory = { $in: spaceId };
const sortingQuery = { publishedDate: -1 };
const filteredFeeds = await Feed.find(filters).sort(sortingQuery);
publishedDate 具有以下格式 MongoDB中的日期格式为“Fri Mar 29, 2019 21:21:25 GMT+0530(印度标准时间)”
非常感谢您的帮助,谢谢。
【问题讨论】:
标签: node.js mongodb express mongoose