André Martins
04/19/2022, 10:14 AMinsertMany
query and trying to use an upsert although there is no InsertManyOption for upsert
I came up with the following but this is very inefficient, is there any other way to insert and ignore duplicates?
myCollection.bulkWrite(
*customers.map {
updateOne<Customer>(
Customer::id eq it.id,
KMongoUtil.toBsonModifier(it, UpdateConfiguration.updateOnlyNotNullProperties),
upsert()
)
}.toTypedArray()
)