Typescript 如何从MongoDB中找到今天的数据';谁的日期?

Typescript 如何从MongoDB中找到今天的数据';谁的日期?,typescript,ionic-framework,Typescript,Ionic Framework,我正在使用以下代码查找数据:: module.exports.getdat=函数(回调){ console.log(“数据库”); 常量查询={sdate:new Date()} 查找(查询、回调); }您需要使用特定的日期范围 可以在同一文档部分中使用$gte和$lt指定范围: db.time.find({sdate: {$gte: new Date("2018-08-03"),$lt: new Date("2018-08-04")}});

我正在使用以下代码查找数据::

module.exports.getdat=函数(回调){
console.log(“数据库”);
常量查询={sdate:new Date()}
查找(查询、回调);

}
您需要使用特定的日期范围

可以在同一文档部分中使用$gte和$lt指定范围:

db.time.find({sdate: {$gte: new Date("2018-08-03"),$lt: new Date("2018-08-04")}});