mongoexport mongodb导出 如何设定时间条件 ---liaofengwei

废话不说,直接上实例:

 

---如下OK  有值!!!!
mongoexport --host 10.110.70.100:27017  --username name   --password 123123  --db  Cx   ^
--query "{$and :[{'vin':'LHGH21612M8000099'},{'report_cmd':2},{collect_time:{$gte:new Date(1595923200000)}}, {collect_time:{$lt:new Date(1595930400000)}}]}"   ^
--collection  report_result_2020_009  -f  _id,vin,report_time,collect_time,report_hex   --type csv  --out E:/transportRecord8.csv


---如下OK  有值!!!!
2020-07-28 16:00:00
1595923200000
2020-07-28 18:00:00
1595930400000
mongoexport --host 10.110.70.100:27017  --username name   --password 123123  --db  Cx   ^
--query "{$and :[{'vin':'LHGH21612M8000099'},{'report_cmd':2},{collect_time:{$gte:new Date(1595923200000)}}, {collect_time:{$lte:new Date(1595930400000)}}]}"   ^
--collection  report_result_2020_009  -f  _id,vin,report_time,collect_time,report_hex   --type csv  --out E:/transportRecord8.csv

---如下OK  有值, 最终的多条件  最优方案 !!!!!!!!!!!!
https://tool.lu/timestamp/
2020-07-29 16:03:25.000+08:00
1596009805000
2020-07-29 16:04:05.000+08:00
1596009845000
mongoexport --host 10.110.70.100:27017  --username name   --password 123123  --db  Cx   ^
--query "{$and :[{'vin':'LHGH21623M8000099'},{'report_cmd':2},{collect_time:{$gte:new Date(1596009805000)}}, {collect_time:{$lte:new Date(1596009845000)}}]}"   ^
--collection  report_result_2020_009  -f  _id,vin,report_time,collect_time,report_hex   --type csv  --out E:/transportRecord9.csv

意思语句刚好导出了指定的 5条数据!!

gte 是大于等于的意思   gt是大于的意思     lt是小于的意思   lte是小于等于的意思!!!
gte 是大于等于的意思   gt是大于的意思     lt是小于的意思   lte是小于等于的意思!!!

 

注意  ^ 是转行符号,请根据具体需求来使用!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值