How can a file (say image) be stored inside a MongoDB collection, using command line?
Question: There is option of GridFS but that requires a driver(some language). Can't we
insert a file in a table and display as a field(may b the path of file)? I
tried one approach using Gridfs in python.

from pymongo import MongoClient

import gridfs

db = MongoClient().gridfs_example

fs = gridfs.GridFS(db)

a = fs.put("hello world")

After using the last command in pymongo, a error is coming..


Answer: You can keep the path of the file stored on server in collection that is being
used. As there is only 16 MB limitation to store in collection for a field.

so you can store the filename/path in collection.

Please correct me if i am wrong.

