1、mongo查询语句:
db.quarkContext.find({"submitTime":{"$gt":ISODate("2019-07-13T00:00:00.000+08:00")},"rawResult":{$regex:/"ok":0/}},{"info.sId":1,"submitTime":1,"responseTime":1})
2、编写导出查询语句文件quary.js
db.quarkContext.find({"submitTime":{"$gt":ISODate("2019-07-13T00:00:00.000+08:00")},"rawResult":{$regex:/"ok":0/}},{"info.sId":1,"submitTime":1,"responseTime":1}).forEach( function(document) { print(document.info.sId + "," + document.submitTime + "," + document.responseTime); } )
3、执行语句
./mongo 127.0.0.1:40000/shtel /data/service/mongodb/bin/query.js > /data/service/mongodb/bin/result.csv
query.js:查询条件及输入指令
result.csv:输出结果文件