spring-projects / spring-projects/spring-data-mongodb
Consider adding options parameter to ReactiveMongoTemplate.insertAll
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi folks
Today I faced with need to execute ReactiveMongoTemplate.insertAll with unordered: false parameter since it allows to skip duplicates while inserting (mongo doc). Unfortunately, there is no insertAll with options, however it could be implemented with ReactiveMongoTemplate.execute like this
reactiveMongoTemplate.execute(myCollection) { it ->
it.insertMany(listOf(), InsertManyOptions().ordered(false))
.toMono()
.map { result -> result.insertedIds.size }
}
.next()
I don't like this approach since it requires to manually map entity to Document
Could you please consider implementing insertAll with InsertManyOptions parameter in ReactiveMongoTemplate?
Thank you
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.
Research direction
Start with the ReactiveMongoTemplate.insertAll API described in the issue, then compare it with the shown ReactiveMongoTemplate.execute and InsertManyOptions usage. Define the requested overload's behavior around ordered inserts and entity-to-document mapping, and verify that insertAll accepts and applies the options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100