当我试图从mongodb集合中获取数据时,我得到了以下异常。这个集合有非常庞大的数据。
例外情况是:
com.mongodb.MongoQueryException: Query failed with error code 10334 and error message 'BSONObj size: 24020168 (0x16E84C8) is invalid. Size must be between 0 and 16793600(16MB)' on server 10.15.0.227:27017
下面是我用来从mongodb获取数据的查询:
db.getCollect
我的pc运行的是mongo 1.6.5。
我的一个集合有973525条记录,当我试图在该集合上找到不同的关键字时,它给了我异常
查询为
db.collection.distinct("id")
java.lang.IllegalArgumentException: 'ok' should never be null...
at com.mongodb.CommandResult.ok(CommandResult.java:30)
at com.mongodb.CommandResult.throwOnError(CommandResult.j
MongoCursorException' with message '$ operator made object too large
我正在尝试使用update命令更新一些对象
$collection->update({"_id" => array('$in' => array(2,3,4,5)) } ....)
然后得到了这个例外。有任何关于它的意思的提示吗?这样我就可以继续调试了。
这就是我如何读取我的大型MongoDB表(每个对象的属性中都有非常大的数据块):
DBCursor cursor = collection.find(/* my query */);
while (cursor.hasNext()) {
DBObject object = cursor.next();
doSomething(object); // no data stays in memory
}
cursor.close();
我得到了:
java.lang.OutOfMemoryError: Java heap space
at java.lang.StringCoding$St