how to insert blob data into mongodb

1,462 views
Skip to first unread message

Navneet Mathpal

unread,
Feb 12, 2014, 6:38:38 AM2/12/14
to mongod...@googlegroups.com
Hi,

I am new in mongodb i have just started it.

I have just installed mongodb in my system,i want to insert a blob data in mongodb how can i do it .

Thanks
Navneet Mathpal

Eoin Brazil

unread,
Feb 12, 2014, 6:55:29 AM2/12/14
to mongod...@googlegroups.com
Hi Navneet,

It depends on the size of your blob of data, you can store it in a document using the binary data type (see this page for more info) or if the resulting document would be larger than 16MB you can use GridFS (see this FAQ).

Which language and driver are you using to add this data from your application ? I can give a better answer regarding how you might do this with this information.

Thanks!
Eoin

Navneet Mathpal

unread,
Feb 12, 2014, 7:36:55 AM2/12/14
to mongod...@googlegroups.com
hi Eoin

I am using java and no idea about driver because i have just installed mongodb, can u suggest..


Thanks
Navneet
Message has been deleted

Jeremy Mikola

unread,
Feb 13, 2014, 4:00:32 PM2/13/14
to mongod...@googlegroups.com


On Wednesday, February 12, 2014 7:36:55 AM UTC-5, Navneet Mathpal wrote:
hi Eoin

I am using java and no idea about driver because i have just installed mongodb, can u suggest..

Using the Java driver, you can simply store a byte array and the driver will convert it to the BSON binary type. This is discussed a bit in the Java Types documentation, as well as this mailing list thread. As Eoin mentioned above, if you are storing large binary blobs (exceeding the 16MB document limit), you will need to look into using the GridFS API, which is documented here for the Java driver.
Reply all
Reply to author
Forward
0 new messages