pymongogridfsmulter-gridfs-storage

Is there a method available to store a file in mongo under a specific directory


I need to maintain a file system in mongo where I need directories to be created and file should be placed in the directory which i have created. So is there any in built functionality in python or how we can do that using GridFs?. So basically along with uploading the file i need to mention the directory where it needs to be placed


Solution

  • GridFS permits specifying the name of the file. You can put anything you like in there including a path where components are separated by slashes so that it looks like a filesystem path.

    However, GridFS does not provide any facilities for hierarchical traversal of stored files (i.e. grouping files into directories). You'd have to implement that in your own application/library if you need this functionality.