MongoDB命令 日期查询

MongoDB 日期查询有Date 和ISODate两种方式:
//方式一:new Date(2019,9,16)
如,查询大于等于2019年10月16日
db.sxn0929CustomerInfo.find({'createTime':{$gte:new Date(2019,9,16)}});
月份从0开始,如果是10月则月份需要写9


//方式二:new ISODate("2019-10-16T02:29:38.507Z")
db.sxn0929CustomerInfo.find({'createTime':{$gte:new ISODate("2019-10-16T02:29:38.507Z")}})

发布了48 篇原创文章 · 获赞 4 · 访问量 3249

猜你喜欢

转载自blog.csdn.net/Sunxn1991/article/details/102581733