I have uploaded PDF/PST file in mongodb by mongofiles, but when retrieving it in R(BSON) and converting it to "Character" type, I couldn't find the PDF/PST file. Is it possible to upload PDF file or PST file? Which file formats does mongodb support (other than CSV,TSV,TXT,audio) ?

2 Answers 2


BSON has a Binary data type in which you can store anything you want. MongoDB sees it as a binary blob and does not care what type of data it is, so of course ot is possible to store PDF files. MongoDB documents are limited to 16 MB in size, so if you need to store large data, try GridFS.


  • Can you please tell me how to recover that data into txt format from BSON in R
    – Aashu
    Aug 20, 2013 at 13:38

I think you are confusing the ability to store files with the ability to translate between file types - your database is not going to change a PDF into a text file (or any other type of file), it will allow you to store a PDF file, as a binary blob, then retrieve that file later in exactly the same format (whether you store it directly or you use GridFS). For straight file storage, any file format is supported - and it can be any file type, format - it can even be invalid. It's just a bunch of binary data from the database perspective.

If you want to convert between types or examine files in general you need to use some sort of translation utility to do so - in your language of choice.

  • I do know we can upload any kind of file but here the question is ,do we really have to upload a non readable file because it seems to be impossible to get it back after uploading(BSON).for ex. after uploading a pst file and reading readBin(#reading BSON),i did not get the text.
    – Aashu
    Aug 30, 2013 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.