schema 中定义的
"checkin_date": {
"bsonType": "timestamp",
"description": "打卡时间戳"
},
查询出来后变成了日期
{
"_id": "686d2dfde793cfeda07832d4",
"checkin_date": "2025-07-08T14:41:01.386Z",
"habit_id": "686a6726824aa27c687cc1c9",
"remark": "",
"user_id": "68615642ca6d1d6181fdc362"
},
最主要的使用dbCmd.gte查询也不生效
db.collection('lifeup-habit-checkin')
.where({
/checkin_date:dbCmd.gte(1751799495233).and(dbCmd.lte(1751801243790))
})
.get();
英雄老张 (作者)
数据库存储的是时间戳,如下图
2025-07-09 17:35