mongo导出查询结果到csv

2021-02-20 11:30:37 | 编辑

var rows=db.getCollection('rank').find({project:"430000-6a6409b8abc243828ed0d584cb710fa4","target.id":"001","target.name":"subject","range.name":"province"})
.sort({rank:1,student:1})

while(rows.hasNext()) {
    printjson(rows.next());
}
 

 

var rows=db.getCollection('rank').find({project:"430000-6a6409b8abc243828ed0d584cb710fa4","target.id":"001","target.name":"subject","range.name":"province"},{"rank":1,"student":1})
.sort({rank:1,student:1})

while(rows.hasNext()) {
    var row=rows.next();
    print(row.student+","+row.rank);
}
 

 

mongo 192.168.1.192:29000/project_data projectRank.js>projectRank.json

 

 

 

登录后即可回复 登录 | 注册
    
关注编程学问公众号