MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

MongoDB returning corrupted PDF

I am using following command to store PDF in mongodb :
mongofiles -d mycollection put abc.pdf

and below mentioned command for downloading the PDF :
mongofiles -d mycollection get abc.pdf

The downloaded PDF is not opening. Getting message as - File Not supported/Corrupted.

I also tried storing/downloading using JAVA(GridFS) code but the issue remains the same.

Has anybody ever faced this problem ?

Well, for one thing, the -d switch refers to a database, not a collection.
See https://docs.mongodb.com/database-tools/mongofiles

1 Like