I can\'t figure out how to stream a binary file from GridFS with spring-data-mongodb and its GridFSTemplate when I already have the right ObjectId.
GridFSTemplate
ObjectId
Wrap the GridFSFile in a GridFsResource or use this
GridFSFile file = gridFsTemplate.findOne(Query.query(Criteria.where("_id").is(fileId))); GridFsResource resource = gridFsTemplate.getResource(file); return resource.getInputStream();