Skip to content

Provide a way to set options on the GridFSBucket instance used in GridFsTemplate [DATAMONGO-2165] #3029

Open
@spring-projects-issues

Description

@spring-projects-issues

ogerardin opened DATAMONGO-2165 and commented

GridFSBucket has a set of configurable options, namely:

  • bucketName
  • chunkSizeBytes
  • disableMD5
  • readConcern
  • readPreference
  • writeConcern

Currently there's no way to set any of these options on the GridFSBucket instance used by GridFsTemplate. The instance is provided by method getGridFs() which just calls GridFSBuckets.create(db) or GridFSBuckets.create(db, bucket) depending if we have a bucket name or not. All options have default values.

An easy and quick fix is to make the GridFsTemplate class extendable, and in particular to make the method getGridFs() overridable so that one could customize the GridFSBucket instance returned by this method using any of the GridFSBucket.withXXX() methods.

Or the GridFsTemplate could use a GridFSBucketFactory, or any other mechanism to allow the customization of the GridFSBucket.

 


Affects: 2.1.3 (Lovelace SR3)

Reference URL: https://stackoverflow.com/questions/53728853/how-do-i-disable-gridfs-md5-calculation-in-spring-boot

1 votes, 2 watchers

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions