尝试根据日期范围查询数据库这行不通吗?
trying to query a database based on date range would doesn't this work?
something.aggregate().match({
createdAt: { $gte: '2020-03-02', $lte: '2021-03-02' },
});
(也尝试将日期包装在 ISODate 中)
returns 一个空列表
示例数据库条目
{
"_id": ,
"createdAt": "2020-09-10T18:56:15.094Z",
"updatedAt": "2020-09-10T18:56:15.094Z",
}
需要做
new Date('2020-03-02')
something.aggregate().match({
createdAt: { $gte: '2020-03-02', $lte: '2021-03-02' },
});
(也尝试将日期包装在 ISODate 中) returns 一个空列表
示例数据库条目
{
"_id": ,
"createdAt": "2020-09-10T18:56:15.094Z",
"updatedAt": "2020-09-10T18:56:15.094Z",
}
需要做
new Date('2020-03-02')