spring-projects / spring-data-mongodb

Provides support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-mongodb/
Apache License 2.0
1.61k stars 1.08k forks source link

Use of arrayFilters in @Update in mongo repository #4705

Open andersonfaria-hotmart opened 4 months ago

andersonfaria-hotmart commented 4 months ago

It'd be nice to execute all update options in update repositories like:

@Query("{}")
@Update("{${'$'}set: {'productDetails.${'$'}[elem].isExcluded': false}}, {arrayFilters: [{'elem.id': ?0}]}")
suspend fun deleteProductDetailById(productId: String): Int

But mongo repositories seems to not recognize arrayFilters.

christophstrobl commented 4 months ago

Thank you @andersonfaria-hotmart for bringing this up - would be a nice enhancement.