top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to upload pdf files to MongoDB

+1 vote
106 views

I have searched the method and found that GridFS might help. I refer the tutorial as below:
http://api.mongodb.com/python/current/examples/gridfs.html

But there is one problem, I dont know how to insert the local address to the code. It means that I would like to specify the local address of a pdf file and upload it to the database, but I dont know how to do it.

I also try to add the address of file into "put()" as:

a = fs.put("C:myfile.pdf")

But it doesnt work, if you know the answer, please let me know.

posted May 22, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

Similar Questions
0 votes

A couple of months ago I launched a web application for a customer using mongodb for the first time. One of the collections can have documents that store a single .pdf file in binary format. The size of the .pdf file that gets stored in the document is always around 7mb.
To my surprise, the documents that do contain the .pdf files seem to be taking up double the space. As it stands the collection size is at 70gb with only 3900 documents containing the 7mb .pdf file. How can that be, please help?

+1 vote

How to connect MongoDB data which is stored in remote server(I have remote server details) locally?And Is there in Mongo UI to connect or only commands will help?If so please give some links to run commands.

0 votes

MONGODB 3.2.8, WIREDTIGER STORAGE ENGINE
SINGLE COLLECTION HAS MORE THAN 500G, WHETHER IT NEEDS TO BE SEPARATED?

WHAT PARAMETER SHOULD BE ADJUSTED ?

0 votes

I would like to know how to store files into mongo... I am using angular on the front end...
How do I set up my post and get methods to include the createStream and writeStream?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...