I wanns search all entries on a specific date
`var userSchema = new Schema({ 名称:字符串, 电子邮件:字符串, }, { 时间戳:true }); // 这里的日期是以 ISO 格式存储的
router.get('/date', (req, res) => {
const dateTodetch = '2020-12-26' //我们要获取所有记录的日期,格式为“yyyy-mm-dd”
//Since @26 it could be on anytime, so i'll search from 0 to 23.59
UserModel.find({
createdAt: {
$gte: "2020-12-26",
$lt: "2020-12-27"
}
}).exec((err, rec) => {
if(err) res.status(400).json(err)
res.json(rec)
})
})