尝试使用 java 从 mongodb 获取数据,但我的代码将花费更多时间来获取记录。
mongodb数据在mongo db中有非常大的100万条记录。
MongoDatabase database = config.getCollection();
String docName = slpitDName[i];
MongoCollection<Document> collection = database.getCollection(docName);
BasicDBObject whereQuery = new BasicDBObject();
whereQuery.put("flag", 0);
List<Document> documents = (List<Document>) collection.find(whereQuery).into(new
ArrayList<Document>());