Questions tagged [spring-data-mongodb-reactive]

This library implements database operations using Reactive Programming for MongoDB

62 questions
1
vote
2 answers

Spring webflux ReactiveMongoOperations find by elemMatch

I have a collection like this: {"type": "bbb", "category": "aaa", "from": "eee", "INTERLOCUTOR": ["test1", "test2"]} and I want to find INTERLOCUTOR have test1 ; how to use by ReactiveMongoOperations?
1
vote
1 answer

WebFlux functional endpoint, how to return a ServerResponse with retrieved data and no unnecessary block/wait?

I am totally new to reactive code and after a number of tutorials and youtube videos I am trying to setup a tiny test application using functional endpoints; a simple RouterFunction, RouterHandler and Repository. The problem is how to return an…
1
vote
0 answers

ReacticveMongoTemplate and MongoTemplate (blocking) in same application

Is configuring ReactiveMongoTemplate and MongoTemplate (blocking) in the same application can cause problems? Or Can we have reactive and non-reactive mongo configuration in the same application ?
0
votes
0 answers

addToSet in array via Spring Boot Mongo template

FirstDoc: { "_id": "containerId1", "executionID" : "executionId1", "assignedContainers": [ { "_id":"container2", "manufacturingItemGroups":[ { "_id": "figure2", "amount": 2 } ], }], …
0
votes
0 answers

Multiple Database Configurations in Spring Boot

I need to configure 2 MongoDB databases with my Spring Boot v3.0.5 application. I have made 2 MongoDB configurations as follows: RemindersConfig.java @Configuration @EnableReactiveMongoRepositories(basePackages =…
0
votes
0 answers

Duplicate Key Exception from Mongo DB does not gets caught

Trying to insert duplicate documents in mongo db with help of mongo repository. Snippet example: try{ //insertion of duplicate doc in mongo db } catch(org.springframework.dao.DuplicateKeyException e){ // syso for something else for sake of this…
0
votes
1 answer

Spring data reactive MongoDB Null reference when acessing object from documents link @DocumentReference

I would like your help. I'm working with Spring reactive (WebFlux) and mongoDB also reactive. In my model I have an association of two entities: User and Post. Modeling the problem, 1 User has a list of associated Posts (One-to-Many reference),…
0
votes
0 answers

Spring Data MongoDB Repository with dynamic collection name on every request

We are fecthing the data from Mongo db usinf spring data reactive repository. The collection name is dynamic which comes in the request. So we need to set it on every request and fetch the data from that collection. @Document(collection = "
0
votes
0 answers

Mongo DB reactive streams ForEach operation corresponding to Mongo DB Async driver

I have been trying to move from Mongo-DB async driver to reactive streams. so far I have been successful in migrating most of the operations. But I'm stuck with MongoDbIterable and trying to find a compatible version for reactive driver Here is the…
0
votes
1 answer

How to map array of objects to array of plain values in Spring Data Mongo

I have a collections of documents, which have an inner array of objects with two fields: { "state" : [ { "date" : ISODate("2022-08-06T00:56:29.615Z"), "value" : 1 }, { "date" :…
0
votes
0 answers

Is it possible/ how to perform upsert on a sharded MongoDB cluster

I’d like to perform an upsert operation on a sharded MongoDB cluster, but I get the exact same error for every variation I try. When I write this way to a local standalone Mongo, it works perfectly, but on the sharded cluster I get the errors. My…
0
votes
0 answers

How to disable auto creation of db and collection in spring data mongodb?

I am working on a spring boot project which uses spring data mongodb. Spring data mongodb auto creates the db and collection when it doesn't exists. I want to disable auto creation of db and collection in mongodb when it doesn't exists. How to…
0
votes
2 answers

Spring Webflux: I want to send data to kafka after saving to database

I'm trying to do send data to kafka after my database operation is successful. I have a /POST endpoint which store the data in mongodb and return the whole object along with mongoDB uuid. Now I want to perform an addition task, if data is…
0
votes
1 answer

Mongo Replicaset monitoring replaces hostnames with IP and leads to failed hostname verification

we have a problem with the mongo java driver and the monitoring thread. We are running a 3 server replicaset and connect our spring boot microservices by using the hostnames. mongodb://:@A:27017,B:27017,C:27017/?tls=true Up until…
0
votes
1 answer

Spring Data Reactive Mongo Operator how to call unset operation on nested field after performing lookup stage in an aggregate pipleine

I am merging records from two collections projects and card_types in an aggregation pipeline and then trying to remove the cardFields field of the merged record from the result. So the idea is that from the aggregate result which will be { …