mongodb Java驱动程序性能问题

时间:2013-08-01 07:07:26

标签: mongodb mongodb-java

我使用mongodb作为数据库在java中创建一个restful服务。 该集合拥有大量数据(近150万)..

使用我的服务返回json。我正在使用以下代码..

DBCollection tbl = db.getCollection();
DBCursor cur = tbl.find('tag',"")
BasicDBList list = new BasicDBList();
while(cur.hasNext())
    list.add(cur.next());

但这种方法需要很长时间。能否请您建议一种可以提高性能的方法。

PS:我尝试使用

  

cursor.toArray()

但它没有增加演出时间。

0 个答案:

没有答案