Skip to content

Consider adding options parameter to ReactiveMongoTemplate.insertAll #4252

Open
@MisterRnobe

Description

@MisterRnobe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions