Questions tagged [spring-data-mongodb-reactive]

This library implements database operations using Reactive Programming for MongoDB

62 questions
1
vote
0 answers

Cannot convert a String to Decimal128 in @Query usgin Spel

I'm trying to do a convertion from String to Decimal128 in a @Query to perform a paging operation using the following snippet: public interface ExpenseCollectionRepository extends ReactiveMongoRepository { …
1
vote
1 answer

MongoDB: how to aggregate from multiple collections with same aggregation pipeline

I'm trying to get aggregations with same aggregation pipeline including $match and $group operations from multiple collections. For example, with a users collection and collections of questions, answers and comments where every document has authorId…
1
vote
1 answer

Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}

I'm using reactive mongodb within a spring boot application, but I get the errors bellow: org.springframework.data.mongodb.core.ReactiveMongoTemplate - Streaming aggregation: [{ "$match" : { "type" : { "$in" : ["INACTIVE_SITE", "DEVICE_NOT_BILLED",…
1
vote
0 answers

Spring Data MongoDB not able to load reference collection (@DocumentReference)

In Spring data findAll method reference object is coming as null I am using Reactive Mongo Repository Ex Parent Object @Data @Document(collection = "country") public class CountryBean { @Id private String id; private String name; …
1
vote
0 answers

Can Reactive Mongo Template execute MergeOperation?

I want to know if it is possible to execute MergeOperation snippet: MergeOperation mergeOperation = Aggregation.merge() .intoCollection("someCollection") .on("_id") …
1
vote
0 answers

Reactive Spring Data Mongo Merge Operation

I want to write to MongoDB with Spring Integration and Project Reactor. My needed command is a merge operation, so I started that with the following snippet: MergeOperation mergeOperation = Aggregation.merge() …
1
vote
1 answer

Map one mongodb field to two POJO properties

I have a property on my mongodb entity, lets call it foo. When I retrieve this property, i want its value to be set on two different properties of my POJO, foo and bar So if a document is registered as: { "_id": "xxxxxx", "foo": "123", } When…
1
vote
1 answer

Use $function (javascript) in mongo repository @Aggregation pipeline

I have the below query that runs fine in mongo shell. I have to use this from my spring boot java application. db.UserGames.aggregate([ { $match: {$and: [{timestamp: {$gte : ISODate("2021-12-14T09:34:51.000Z"), $lte:…
1
vote
2 answers

"Found ambiguous parameter type Void"? Spring Integration with Project Reactor

I'm using Project Reactor with Spring Integration to read from Kafka and write to MongoDB, and I the Kafka consume works well, but the .handle(MongoDb.reactiveOutboundChannelAdapter(mongoFactory)) stucks. I've seen that the internal code of this…
1
vote
0 answers

How to paginate an embedded documents in mongodb

I've a project based on a mongodb database and I need to accomplish the following description in a very optimized way. My database has a Document with another embedded documents and I need to apply pagination in this embedded documents, eg: { _id:…
1
vote
1 answer

How to get distinct Items by one field in MongoDB using @Query annotation with pagination enabled

I'm trying to get the list of distinct items by a specific field (userId). Currently I'm using this kind of approach to get records from MongoDB using ReactiveCrudRepository. Additionally, I want this result to be further filtered and get only the…
1
vote
0 answers

Kotlin suspend function in Reactive Data Repositores return null

I am facing a "problem" with mongo reactive repositories. I am trying to use kotlin's coroutines and instead of writing fun declaration like this: fun findEntityById(id: String) : Mono I wrote a suspend function like this : suspend fun…
Barracuda
  • 477
  • 5
  • 19
1
vote
0 answers

Spring WebFlux Reactive MongoDB - how to combine two change streams?

In my app i want to combine 2 change streams to listen to changes to some filter object and to the inserts/deletes to the collection which is actually in question (to which i apply the filter residing in a different collection) Therefore i have an…
1
vote
0 answers

NestedClass test failing, because Spring-Data-Mongo-Reactive is closing MongoDb connection (state should be: server session pool is open)

1) Problem Description: I am using a Spring-Data-Mongo-Reactive, Testcontainers and JUnit 05; I have a Test-Class with simple-test and ‘Nested-Test-Class’(which has a simple test, as well); When, JUnit tests the NestedClass, the MongoDb Connection…
1
vote
1 answer

Reactor flux throws illegalArgumentException - suspecting due to bufferTimeout

I have a spring application which builds a reactive pipeline as follows: buildPipeline(). // returns a flux based on changeStreamEvents or Kafka receives .bufferTimeout( capacity, Duration.ofSeconds(1)) . flatMap( r -> { element x =…