spring-projects / spring-projects/spring-data-mongodb

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

Open
#3,029 6 comments 0 reactions 1 assignee View on GitHub

@christophstrobl is already working on this.

Since Dec 30, 2020.

in: core type: enhancement
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.