Questions tagged [spring-data-mongodb-reactive]

This library implements database operations using Reactive Programming for MongoDB

62 questions
15
votes
3 answers

@EnableAutoConfiguration(exclude =...) on tests failed in Spring Boot 2.6.0

I tried to upgrade my data-mongo example project to Spring Boot 2.6.0. There is a test designed to run against Testcontainers, I also included the embedded mongo dep for other tests, so I have to exclude the AutoConfiguration for embedded mongo to…
Hantsy
  • 8,006
  • 7
  • 64
  • 109
6
votes
0 answers

Bulk operations using spring-data-mongodb-reactive

Is it possible to perform MongoDB bulk operations (like update/upsert) using ReactiveMongoTemplate or spring-data-mongodb-reactive?
6
votes
2 answers

Calling methods in two different ReactiveMongoRepository's in a transaction using Spring Data MongoDB?

When using the reactive programming model with Spring Data MongoDB it's possible to execute transactions like this: Mono result = template.inTransaction() .execute(action ->…
Johan
  • 37,479
  • 32
  • 149
  • 237
4
votes
0 answers

FluxUsingWhen cannot be cast to Iterable error when using spring data rest with reactive repository

I configured a ReactiveSortingRepository to see the reactive capabilities on spring data rest, in the past I've mostly used PagingAndSortingRepository to expose resources as REST endpoints so wanted to see how well reactive stuff works. the…
3
votes
1 answer

How can I filter sub-documents from MongoDB with SpringBoot?

I have documents in a collection such as : { "login":"xxx", "someAttribute":"someValue", "subDocs":[ { "data": "val1", "subDocNestedArray":["WWW","AAAA"] }, { "data": "val2", "subDocNestedArray":["AAAA"] …
pibou
  • 51
  • 5
3
votes
1 answer

Convert enum value by field

I'm using reactive MongoDB in spring. Here is the Enum Language: public enum Language { ARABIC("ar"), UZBEK("uz"); private final String code; Language(String code) { this.code = code; } public String getCode() { …
2
votes
1 answer

spring data mongo reactive throw org.springframework.data.mapping.MappingException when eager loading nested @DbRef

Basically, I have a User collection that contains a @DbRef to UserPlot (plots) collection. Inside UserPlot, I also have a @DbRef to Plot (plot). My goal is to find all users and eagerly load plots to User (also eagerly load plot to…
2
votes
0 answers

How do i put multiple conditions inside spring data mongodb aggregation filter?

Mongodb states that it is possible to put multiple conditions inside cond of filter. Like this: { $filter: { input: [ 1, "a", 2, null, 3.1, NumberLong(4), "5" ], as: "num", cond: { $and: [ { $gte: [ "$$num",…
2
votes
1 answer

Bulk Update with Spring Data MongoDB Reactive

How can I perform bulk perations using ReactiveMongoTemplate? Basically I want to initialize bulk using db..initializeUnorderedBulkOp() and execute it using .execute(). I know there is a way to do this using simple…
2
votes
1 answer

Why am I getting "NoSuchFieldException: handle" with Kotlin 1.5.10 on JDK 16.0.1, Spring Boot 2.5.1 & Spring Data MongoDB with default config?

New greenfield project using Kotlin 1.5.10 on JDK 16.0.1 with Spring Boot 2.5.1 (from the Gradle org.springframework.boot plugin version 2.5.1) with Spring Data MongoDB (via org.springframework.boot:spring-boot-starter-data-mongodb-reactive). My…
2
votes
1 answer

SpringData MongoDB @TypeAlias ceased to work after upgrade

I'm trying to solve project problems after upgrading from Spring Boot 2.3.1.RELEASE to Spring Boot 2.5.0 (doesn't work either for 2.4.0+) with @TypeAlias seem to be ignored. I use Kotlin and reactive manner to achieve this. I got set basePackages to…
2
votes
0 answers

Reactive Global Transaction with multiple databases (MySQL, MongoDB)

I'm using MYSQL with R2DBC (with spring-data-r2dbc and jasync-r2dbc-mysql) and Reactive Mongo with spring-data-mongo-reactive. I want to set transaction which includes both operations. At first, I considered JTA and ChainedTransactionManager but as…
1
vote
0 answers

What are MongoManagedTypes - new in spring-data-mongodb version 4.0

In MyMongoConfig extends AbstractReactiveMongoConfiguration I created a bean when using version 3.2 of spring-data-mongodb: @Override public MongoMappingContext mongoMappingContext(MongoCustomConversions customConversions) throws…
1
vote
0 answers

Spring Boot 3.0.5 ReactiveMongoTemplate update operation throws DuplicateKeyException

I tried to update some of my sample codes to Spring Boot 3.0.5 from Spring Boot 2.7. @Document(collection = "posts") @Data @ToString @Builder @NoArgsConstructor @AllArgsConstructor public class Post implements Serializable { @Id private…
Hantsy
  • 8,006
  • 7
  • 64
  • 109
1
vote
1 answer

Mongock does not run changeunit in kotlin project

I have Java + maven project - https://github.com/petersuchy/mongock-test-java based on Mongock reactive example (https://github.com/mongock/mongock-examples/tree/master/mongodb/springboot-reactive) And everything works well. I tried to migrate that…
1
2 3 4 5