Downloading files from MongoDB GridFS - 7.0

MongoDB

author
Talend Documentation Team
EnrichVersion
7.0
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Open Studio for Big Data
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Database components > MongoDB components
Data Quality and Preparation > Third-party systems > Database components > MongoDB components
Design and Development > Third-party systems > Database components > MongoDB components
EnrichPlatform
Talend Studio

Procedure

  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.