收藏
回答

db.serverDate()插入数据模型中Date类型字段,CMS显示invalid date?

db.collection('reservation').add({data: {
userId: '{openid}',
roomId: 'whaterver',
date: db.serverDate(),
period: 'afternoon',
_createTime: db.serverDate()
}
})


[{"fields":[{"dateFormatType":"timestamp-ms","description":"CMS 系统字段,请勿随意修改。通过 CMS 系统录入的数据会默认添加该字段","displayName":"创建时间","id":"_createTime","isSystem":true,"name":"_createTime","type":"DateTime"},{"dateFormatType":"timestamp-ms","description":"CMS 系统字段,请勿随意修改。通过 CMS 系统录入的数据会默认添加该字段","displayName":"修改时间","id":"_updateTime","isSystem":true,"name":"_updateTime","type":"DateTime"},{"displayName":"预订人","id":"nm81hj738pb0iuzfycgfo7q12zpqml7d","name":"userId","order":2,"type":"String"},{"copyable":true,"description":"CMS 系统字段,请勿随意修改","displayName":"文档 ID","id":"_id","isHidden":true,"isSystem":true,"name":"_id","type":"String"},{"displayName":"房间ID","id":"1xcwj04axah8s77zbqfcufsj9v6uool4","name":"roomId","order":4,"type":"String"},{"dateFormatType":"timestamp-ms","displayName":"预订日期","id":"m3yzm6o20lji44839yx6zdzruj283zfc","name":"date","order":5,"type":"Date"},{"displayName":"预订时段","enumElementType":"string","enumElements":[{"label":"早场","value":"morning"},{"label":"午场","value":"afternoon"},{"label":"晚场","value":"evening"}],"id":"ewck5gsa0m6l1qk8whquc3u6359i71xt","name":"period","order":6,"type":"Enum"}],"collectionName":"reservation","displayName":"预定"}]




回答关注问题邀请回答
收藏

1 个回答

  • 王远天
    王远天
    2022-06-08

    要查询一个时间范围内的记录怎么写where呢?如果要用db.serverDate()的话。

    2022-06-08
    有用
    回复
登录 后发表内容