该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
具体代码 求大神 ~~~~~~~~
public void getRepostList() throws IOException {
FileOutputStream fos = new FileOutputStream("e:\\测试.csv");
OutputStreamWriter osw = new OutputStreamWriter(fos, "GBK");
BufferedWriter bw = new BufferedWriter(osw);
bw.write("微博ID" + "," + "用户ID" + "," + "用户昵称" + "," + "粉丝数" + ","
+ "关注数" + "," + "评论数间" + "," + "内容" + "," + "认证类型" + "," + "类型");
bw.newLine();
Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("mongotest");
DBCollection coll = db.getCollection("Test1");
//"3741024730206295","3741020430561545",3740961538077773
DBObject doc = new BasicDBObject();
DBObject fDoc = new BasicDBObject();
String array[]={"3741578642809216"};
for(int i=0;i
fDoc.put("root_id",array[i]);
DBCursor cur = coll.find(fDoc);
System.out.println("有数据---"+cur.count());
while (cur.hasNext()) {
doc = cur.next();
bw.write("," + doc.get("_id") + ","+ doc.get("id") + ","
+ doc.get("Nickname") + "," + doc.get("Fans") + ","
+ doc.get("attention") + "," + doc.get("Time") + ","
+ doc.get("text") + "," + doc.get("Type") + ","
+ doc.get("类型"));
bw.newLine();
}
}
bw.close();