https://github.com/spring-proing-proing-projects/spring-projects/spring-data-data-data-data--data--data--data--- mongodb/eskent/2821
我一直在寻找反应式泡沫操作,以将文档作为Spring WebFlux中的批量更新。
就像在Mongo模板中一样,
var bulkOps = mongoTemplate.bulkOps()
for(dto : List<DTO> DTOs) {
Query query = new Query();
query.addCriteria(Criteria.where(ID).is(dto.getId()));
Update update = new Update()
.set(STATUS, dto.getStatus())
bulkOps.updateOne(query, update)
}
bulkOps.execute();
有能力以反应性的方式实施该操作,因为ReactiveVemongotemplate看起来像当前不支持该操作?
so中的similiar主题: bute vishivemongotemplate bulk更新
https://github.com/spring-projects/spring-data-mongodb/issues/2821
https://jira.spring.io/browse/DATAMONGO-1922?redirect=false
I have been looking for ReactiveBulk operations to update documents as a batch in Spring WebFlux.
Like in the Mongo Template
var bulkOps = mongoTemplate.bulkOps()
for(dto : List<DTO> DTOs) {
Query query = new Query();
query.addCriteria(Criteria.where(ID).is(dto.getId()));
Update update = new Update()
.set(STATUS, dto.getStatus())
bulkOps.updateOne(query, update)
}
bulkOps.execute();
is there a workaround to implement that operation in reactive way since reactivemongotemplate look like does not support that operation currently?
similiar topic in so: Bulk Update with ReactiveMongoTemplate
发布评论
评论(1)
很快提醒大量与Updatemulti不同。
批量旨在在单个查询中写下多个对象,因此,更新各种对象。另一方面,UpdateMulti旨在更新所有线条,其中表达式匹配
为反应性散装,您应该能够使用
reactivemongotemplate
并实现类似的内容:您还可以将自定义选项添加到
如果需要的话,bulkwrite()
。如果需要更多过滤器,您可以将它们附加到文档
Quickly remind that Bulk is different than UpdateMulti.
Bulk is meant to write multiple objects in a single query, therefore, update various objects. On the other side, UpdateMulti is intended to update all lines where expression matches
As for reactive bulk, you should be able to use
ReactiveMongoTemplate
and implement something like that:You can also add custom options to
bulkWrite()
if you desire.If more filter is needed, you can append them to the document