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

Add InsertOptions to Bulk Insert Operations [DATAMONGO-1217]

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

@odrotbohm 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

Kevin Conaway opened DATAMONGO-1217 and commented

The mongo java driver has deprecated the WriteConcern.continueOnError on property.

The preferred way to specify that property now is via the InsertOptions class which allows you to specify both a WriteConcern and the continueOnError flag independently of one another.

The MongoTemplate is generally a singleton object for an application and it doesn't make sense to have to set the WriteConcern for the entire application or subclass the template just to set the WriteConcern for a given operation (as was added in DATAMONGO-15)

The batch insert operations for MongoOperations should allow specifying InsertOptions on a per-operation (not per Action as is the case now).

Something like:

insert(Collection<? extends Object> batchToSave, String collectionName, InsertOptions options)

Happy to submit a PR for this if we can agree on an approach


Affects: 1.7 GA (Fowler)

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.