spring-projects / spring-projects/spring-data-mongodb
Add InsertOptions to Bulk Insert Operations [DATAMONGO-1217]
@odrotbohm is already working on this.
Since Dec 30, 2020.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.