x***@126.com
x***@126.com
  • 发布:2025-02-27 18:01
  • 更新:2025-02-27 18:01
  • 阅读:16

数据库schema是date类型 查询时提示 右值类型不正确

分类:uniCloud

操作步骤:
schema:

{    
    "bsonType": "object",    
    "properties": {    
        "startDate": {    
            "bsonType": "date",    
            "description": "开始时间"    
        }    
    }    
}

JQL

const dbCmd = db.command    
const $ = dbCmd.aggregate    
// db.collection('date-test').add({    
//  startDate: new Date()    
// })    

db.collection('date-test').where({    
    startDate: dbCmd.lte(new Date())    
}).get()

报错 右侧值类型不正确

如果查询时用时间戳不报错但是搜不出来

用getTemp 再联表查是正常的

哪里不对么

2025-02-27 18:01 负责人:无 分享
已邀请:

要回复问题请先登录注册