废话不说,直接上实例:
---如下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是小于等于的意思!!!
注意 ^ 是转行符号,请根据具体需求来使用!