我在GridFS(MongoDB版本:2.4.9)中保存文档时看到此错误
2015-05-15 10:19:15,409 ERROR [STDERR] com.mongodb.MongoInternalException: DBObject of size 160038724 is over Max BSON size 16777216
2015-05-15 10:19:15,409 ERROR [STDERR] at com.mongodb.OutMessage.putObject(OutMessage.java:291)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.OutMessage.writeUpdate(OutMessage.java:175)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.OutMessage.update(OutMessage.java:62)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:326)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.DBCollection.update(DBCollection.java:160)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.DBCollection.save(DBCollection.java:800)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.DBCollection.save(DBCollection.java:768)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.mongodb.gridfs.GridFSFile.save(GridFSFile.java:54)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.test.service.state.MongoStateOps.update(MongoStateOps.java:87)
2015-05-15 10:19:15,410 ERROR [STDERR] at com.test.service.state.impl.StateOutputMarshallerImpl$1.run(StateOutputMarshallerImpl.java:45)
2015-05-15 10:19:15,410 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
2015-05-15 10:19:15,410 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
2015-05-15 10:19:15,410 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
以下是代码:
public void update(String correlatorId, byte[] bytes) {
Date now = new Date(System.currentTimeMillis());
if ( gfs ) {
GridFSDBFile state = gridFs.findOne(correlatorId);
state.put( correlatorLastModificationDateMappingField, now );
state.put( correlatorBytesMappingField, bytes );
state.save();
}
}
感谢任何帮助。 以下是详细的MongoDB信息:
db.runCommand("buildInfo")
{
"version" : "2.4.9",
"gitVersion" : "52fe0d21959e32a5bdbecdc62057db386e4e029c",
"sysInfo" : "Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49",
"loaderFlags" : "-fPIC -pthread -rdynamic",
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -fno-builtin-memcmp -O3",
"allocator" : "tcmalloc",
"versionArray" : [
2,
4,
9,
0
],
"javascriptEngine" : "V8",
"bits" : 64,
"debug" : false,
"maxBsonObjectSize" : 16777216,
"ok" : 1
}
" maxBsonObjectSize&#34>仅对收集文档有效,或者它也处理GridFS?
干杯