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

Extend GridFsOperations to allow for chunkSize parameters [DATAMONGO-1615]

Open
#2,523 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 30, 2020.

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

Description

Rainer Schamm opened DATAMONGO-1615 and commented

It would be great if we could extend the GridFsOperations interface to include the chunkSize at various levels.

Increasing the chunkSize can greatly improve performance for certain data scenarios...

E.g.

...
GridFSFile store(InputStream content, String filename, String contentType, DBObject metadata, Long chunkSize);
...

and

...
GridFSFile store(InputStream content, DBObject metadata, Long chunkSize);
...

The implementation would be straight forward:

...
public GridFSFile store(InputStream content, String filename, String contentType, DBObject metadata, Long chunkSize) {

	Assert.notNull(content);

	GridFSInputFile file = getGridFs().createFile(content);

	if (filename != null) {
		file.setFilename(filename);
	}

	if (metadata != null) {
		file.setMetaData(metadata);
	}

	if (contentType != null) {
		file.setContentType(contentType);
	}

	if (chunkSize != null) {
		file.setChunkSize(chunkSize);
	}

	file.save();
	return file;
}

...

No workaround seems to be available as far as I can see.


Affects: 1.10 GA (Ingalls)

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.