mongodb的一个恶心问题
fivesmallq 写道
kk,求教个mongodb的问题..
2011-6-7 10:15:06 com.mongodb.DBTCPConnector$MyPort error
严重: MyPort.error called
java.lang.RuntimeException: bad string size: 3890158
?
记得string有4M的limit,这个3.8M、不到4M啊。
搜了搜~
?
This limit spawns unusal problem: you can write 3.5Mb string, but
can't read it. And docs says nothing about it.
?
int size = readInt();
if ( size < 0 || size > ( 3 * 1024 * 1024 ) )
throw new RuntimeException( "bad string size: " + size );
?
?String 不能大于3M,写入时没问题。读出来的时候,bson decoder时做的检查,才报这个错。
官方建议:
You can file a jira case if you think that should be changed.
Though I'm not sure want to support 4M strings.
If you need a huge field, you probably should use a binary type.
?