MongoDB按时间年月日查询数据

// 按年查询
db.getCollection('test').find({"create_date":{"$regex":"2019"}});
// 按年月查询
db.getCollection('test').find({"create_date":{"$regex":"2019-1"}});
// 按年月日查询
db.getCollection('test').find({"create_date":{"$regex":"2019-1-3"}});

参考

https://blog.csdn.net/qq_27292113/article/details/96150302?utm_source=app

猜你喜欢

转载自blog.csdn.net/qq_41557627/article/details/114199040