Java-Driver: Encountering JAVA-66

5 views
Skip to first unread message

mr.kschan

unread,
Jan 22, 2010, 1:40:36 AM1/22/10
to mongodb-user
i'm encountering the problem as in http://jira.mongodb.org/browse/JAVA-66

What could i do to fix my driver v1.2 copy? checkout the nightly-build
for version 1.2 from git?

Many thx.

Eliot Horowitz

unread,
Jan 22, 2010, 1:43:19 AM1/22/10
to mongod...@googlegroups.com
The fix went into 1.2 - so if your'e seeing an error that's something else.
Are you sure you're object just isn't too big?
What's the error?

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

mr.kschan

unread,
Jan 22, 2010, 1:47:19 AM1/22/10
to mongodb-user
I was getting the .jar from http://github.com/mongodb/mongo-java-driver/downloads

error below:
---

java.lang.IllegalArgumentException: tried to save too large of an
object. max size : 2098176
at com.mongodb.ByteEncoder.getTooLargeException
(ByteEncoder.java:180)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:
196)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:
148)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:
143)
at mongo.MongoController.saveObject(MongoController.java:171)
---

On Jan 22, 2:43 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> The fix went into 1.2 - so if your'e seeing an error that's something else.
> Are you sure you're object just isn't too big?
> What's the error?
>

> On Fri, Jan 22, 2010 at 1:40 AM, mr.kschan <mr.ksc...@gmail.com> wrote:
> > i'm encountering the problem as inhttp://jira.mongodb.org/browse/JAVA-66

mr.kschan

unread,
Jan 22, 2010, 1:52:28 AM1/22/10
to mongodb-user
git hash of that .jar is
"9905326f38dcd6ab667b3c6e6a7995b90acfc415" ...

fyi, my binary is a 5.9Mb file upload pdf via http.

thx =]

On Jan 22, 2:47 pm, "mr.kschan" <mr.ksc...@gmail.com> wrote:
> I was getting the .jar fromhttp://github.com/mongodb/mongo-java-driver/downloads

Eliot Horowitz

unread,
Jan 22, 2010, 1:55:02 AM1/22/10
to mongod...@googlegroups.com
Well that's the problem. The max object size is 4mb.
If you want to store a 5.9mb file you should use GridFS

mr.kschan

unread,
Jan 22, 2010, 2:07:36 AM1/22/10
to mongodb-user

On Jan 22, 2:55 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> Well that's the problem.  The max object size is 4mb.
> If you want to store a 5.9mb file you should use GridFS

oops... thx for telling this ... so my app should use GridFS for those
collections (or entire db?) that will hv >4mb ...

Is this >4mb information better be placed in the tutorial on
http://www.mongodb.org/display/DOCS/Java+Language+Center =]

thx.

Eliot Horowitz

unread,
Jan 22, 2010, 2:15:36 AM1/22/10
to mongod...@googlegroups.com
I would only put the files in gridfs.

Its in the general docs - maybe not java section itself.

mr.kschan

unread,
Jan 22, 2010, 2:34:38 AM1/22/10
to mongodb-user

On Jan 22, 3:15 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> I would only put the files in gridfs.
>
> Its in the general docs - maybe not java section itself.

After reading the gfs-spec from the wiki, i wonder whether i should
store the bin by

GridFSInputFile f = gfs.createFile((byte[]) desc);
f.setContentType("sometype");
f.setFilename("somename");
f.save();

and ...

BasicDBObject o = new BasicDBObject();
o.put("something", something);
o.put("file", f);
coll.insert(o);

Or.. there should be some proper way to do so? Shall i just use o.get
("file") to retrueve that GridFSInputFile ??

thx

ks

Eliot Horowitz

unread,
Jan 22, 2010, 8:50:36 AM1/22/10
to mongod...@googlegroups.com
I would just store the _id of the grid fs file.
so o.put("file", f.getId() )
Reply all
Reply to author
Forward
0 new messages