Skip to main content Skip to complementary content

Downloading files from MongoDB GridFS


  1. Double-click tMongoDBGridFSGet to open its Component view.
  2. Select the Use existing connection check box and from the Connection list, select the component in which the MongoDB connection to be used is defined.
  3. In the Bucket field, enter the bucket in which the files to be retrieved are stored. In this example, it is talend_channel/61.
  4. In the Local folder field, enter the path to the local folder in which you want to store the downloaded files. In this scenario, it is C:/tmp/output.
  5. Select the Use Document ID as output filename check box to rename each downloaded file using the value of its ObjectID attribute.
    Since a file in GridFS is distinct by ID rather than by name, it is possible that several files are using the same file name. For this reason, when downloading this kind of files into the same directory without renaming them differently, an exception is returned to alert that the file being downloaded already exists. In order to avoid this error, you can either select the Overwrite local files check box to replace the existing one with the latest downloaded file or rename these files on the fly using their IDs. In this example, the strategy of renaming these files is adopted.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!