Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
140 views

I'm trying to connect my Spring Boot application (using spring-boot-starter-data-mongodb) to a MongoDB instance within a shared Docker network managed by docker-compose. The connection is failing, and ...
SidaliFetoumi's user avatar
0 votes
0 answers
76 views

I have spring app which uses mongoRepository. I want to have an integration to test my repository by using @DataMongoTest. For some reason my test tries to connect localhost for mongo and gets timeout....
user1474111's user avatar
  • 1,536
1 vote
1 answer
93 views

I followed the Spring's documentation to see traces in Mongodb by adding the bean @Bean MongoClientSettingsBuilderCustomizer mongoMetricsSynchronousContextProvider(ObservationRegistry registry) { ...
2shar's user avatar
  • 121
0 votes
1 answer
83 views

First disclaim: I've already seen these topics ==> Spring MongoRepository very slow to convert POJO ==> performance issue on Spring Data Mongodb I clearly have a similar problem, but nothing in ...
Antoine's user avatar
  • 191
0 votes
1 answer
380 views

I'm trying to set the timeout settings for Mongo connection in my Springboot app but they are not working as intended. I'm not sure if the issue is with the configuration I have or maybe my test is ...
RKodakandla's user avatar
  • 3,502
0 votes
1 answer
194 views

I understand that when using transactions in MongoDB with the WiredTiger storage engine, the isolation level is fixed to snapshot. If I use @Transactional(readOnly = true), it allows consistent reads ...
backtony's user avatar
0 votes
0 answers
47 views

I just started using spring data mongodb aggregation query. fun findRoot(): MarkdownMongoDocument? { val aggregation = Aggregation.newAggregation( MarkdownMongoDocument::class.java, ...
SageJustus's user avatar
  • 1,212
0 votes
0 answers
283 views

I am using below mongo aggregation pipeline in spring boot java to update document in mongodb. Below is the raw mongo query that works fine when executed directly on mongodb db.lock.aggregate([ {...
Reena Upadhyay's user avatar
0 votes
0 answers
50 views

I need to migrate from single database to two database, and my project have a lookup aggregation like LookupOperation lookupOperation = LookupOperation.newLookup() .from("race")...
Man Man Yu's user avatar
0 votes
1 answer
231 views

I have a list of objects of type MyObject, and I wish to insert an object if its not present in the mongo collection, or update if it does. MyObject contains multiple fields, but I want to update if ...
ranban282's user avatar
  • 186
0 votes
1 answer
125 views

I've found some strange behavior of MongoRepository saveAll(). Here's the entity class and repository: @Document public class Entity { @MongoId private String id; ...
Viktor Molokanov's user avatar
0 votes
1 answer
614 views

I have a list of records. Each record needs to have 2 fields: temp(temperature in Celcius) and temp_F(temperature in Fahrenheit). temp field is available in mostly all records. But temp_F is missing ...
Kanhaiya's user avatar
  • 394
0 votes
2 answers
114 views

I need to do an aggregation query , MatchOperation matchOperation = Aggregation.match(new Criteria("age").is(20)); String lookup = "{$lookup: {from: 'race', localField: 'carId',...
Man Man Yu's user avatar
0 votes
1 answer
130 views

I have a school project that needs to support different db at runtime, when only one is selected and is active (a feature to change db after one is selected is not needed). I've been doing some ...
Atram's user avatar
  • 11
0 votes
1 answer
111 views

I want to get by the fastest speed of each car/carId, I have problem in getting/retaining all field when using aggregation in spring mongo . I have check some relatvent in stackoverflow like mongo ...
Man Man Yu's user avatar
0 votes
1 answer
348 views

I have this console query: db.testcol.find({ $expr: { $lte: [ { $toDouble: "$someField" }, 5 ] } }) I want to write it programmatically using Criteria so I can do the following: ...
italktothewind's user avatar
1 vote
1 answer
190 views

We are working with MongoDB. We have an object with an attribute which is a set of SubscriptionFeature, where the SubscriptionFeature is an enum. public class Business { ... private Set<...
Arnold Robert Turdean's user avatar
0 votes
1 answer
83 views

Trying to update element by id = 1234567890 and id= 8888888888 and .. (bulk) inside nested array es in the example below { "name": "template", "process": [ { ...
VitalyT's user avatar
  • 1,701
1 vote
1 answer
414 views

I need to update around 1-1.5 million documents in a Mongodb collection. Is updateMulti() an efficient way to update the document? I mean will it update the documents in batches internally? import ...
Rahul A's user avatar
  • 15
0 votes
1 answer
312 views

I just add MongoDB configuration to the existing Spring Boot application, some test class has @SpringBootTest annotation, and those classes throw exceptions that says I need to define embedded MongoDB ...
fuat's user avatar
  • 1,912
-1 votes
1 answer
892 views

I want to convert values from my mongoDB format into a java Date object(LocalDateTime would also be fine). But I can't find the pattern that does the job. My 'lastupdated' value inside the mongodb ...
BrokenHeart's user avatar
0 votes
1 answer
638 views

I have my MongoDB query which returns the expected Data but I'm struggling to translate it with Spring (org.springframework.data.mongodb.core.MongoTemplate). Let's say in my collection A I have this ...
Barbi's user avatar
  • 188
2 votes
1 answer
458 views

I have a Springboot Reactive Web Rest API with a Mongo Database. My Method in my UserHandler for adding a user looks like this: public Mono<User> addUser(Mono<User> user) { return user ...
Phillip Emanuel's user avatar
0 votes
1 answer
179 views

I am trying to get valid records from mongodb using Spring - mongodb - java driver my question is around the creation of the Bson filter I am looking for matching records that match some filter (...
JavaSheriff's user avatar
  • 7,761
1 vote
1 answer
475 views

This is how my document looks like @Getter @Document(collection = "team") @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Team extends BaseTimeEntity { .... private ...
gs97ahn's user avatar
  • 185
2 votes
0 answers
815 views

I am upgrading my application from Spring Boot version 2.7.3 to 3.0.2 and Java version 8 to 17. My build is successful but during server startup I am getting below exception - Caused by: org....
Bhagyashree Kalshetti's user avatar
1 vote
0 answers
100 views

I need to translate following MongoDb group aggregation to Java code: { $group: { _id: {"startDate": {$ifNull: ["$startDate", null]}, "name": {$ifNull:...
Mikayel's user avatar
  • 179
0 votes
1 answer
135 views

I have problem to save data to mongodb is always null. The data is from redis message publisher that i want to save as a consumer. I hope get the solution. Thanks Service @Slf4j @Service @...
helsaKidsCom's user avatar
1 vote
1 answer
441 views

I'm trying to store java.lang.Class in MongoDb using ReactiveCrudRepository, but I got this following errors. @Document data class Letter( ..., val messageType: Class<*> ) Can't find a codec ...
xX_Xeno_Blade_Xx's user avatar
1 vote
1 answer
3k views

For an assignment I have to write a query with multiple OR conditions. If I had to write it using MongoDB Query Language it would be trivial { $and : [ { $or : [ { "field1" : "value1&...
Olivier Tonglet's user avatar
1 vote
0 answers
81 views

I have mongodb collection for following documents: @Builder @Data @AllArgsConstructor @NoArgsConstructor @Document public class Account { @Id private String id; @Indexed(unique=true) ...
asdasd-mjeesh's user avatar
0 votes
1 answer
206 views

I'm trying to write a Java code for below MongoDB command using MongoTemplate and Criteria and Trim function on the field value in Mongo collection db.employees.aggregate([ { $match : {$...
lucky's user avatar
  • 51
1 vote
1 answer
1k views

Unable to store date in IST format in mongo DB Currently storing date in UTC format during every operations i have to change it into IST format using timezone feature provided by mongo
vishal.saini's user avatar
0 votes
1 answer
2k views

We are injecting the mongotemplate using the spring config <mongo:mongo-client id="mongoClient" connection-string="${mongodb.connect-string}"> <mongo:client-settings ...
ksnstacks's user avatar
0 votes
0 answers
290 views

I'm saving a simple java object to Azure Cosmos DB ( mongo API ) from a spring boot application, using mongoTemplate. The insert works, but I'm having some problem with the dates; my object has a ...
S-Wing's user avatar
  • 591
0 votes
1 answer
1k views

When trying to just make sure the connect is working, this error arises. Error that pops up This is the connect string, Connection string This is my aapp.properties, spring.data.mongodb.uri=mongodb+...
James Cervantes's user avatar
0 votes
1 answer
203 views

I have an abstract calss Report : @NoArgsConstructor @Data public abstract class Report { private String surrogateId; . . . and I need to force all subclasses to fill this surrogateId property. (...
Moussa ELaQ's user avatar
0 votes
2 answers
653 views

I was finding on the internet how to update all the document field values with lowercase. I luckily found a query which I modified as per my requirement and it is working correctly. db.messages....
Shrey Soni's user avatar
0 votes
1 answer
230 views

Insertion of an entity with an Instant value, using ReactiveMongoRepository: MyEntity inserted = myReactiveMongoRepository.insert(entity).block(); System.out.println("inserted.getSent() = " +...
István Békési's user avatar
1 vote
1 answer
1k views

I have created a spring boot application needed for querying and posting to a MongoDB database, I have created a data model that is to be submitted from a website, as well as a service to auto ...
Vincent Banks's user avatar
1 vote
1 answer
132 views

I have the following data which I am querying on: [ { "_id": 1, "domainName": "test1.com", "hosting": "hostgator.com",...
SSM Tariq's user avatar
1 vote
0 answers
488 views

this is my mongo db document classA { private String name; private long elapsedTime; // newly added field } @Document classB extends classA{ private String id; private String owner; } ...
mr.Nobody's user avatar
  • 165
1 vote
1 answer
320 views

I am trying to create a custom Query annotation in a MongoRepository. Everything is fine except the date comparison. I need to find all items that were created on a specific day, so I give 2 date ...
benji62f's user avatar
0 votes
1 answer
38 views

I have the following document : { _ids : ... market : ... contractorName : ... field :... amount : ... } and i want to group it first by market then group the result by field (sum of amounts) ...
Youssef Idraiss's user avatar
0 votes
0 answers
98 views

I have this aggregation that I want to transform into a Spring MongoDb aggregation. A document has several named data in a list. But I want to project only 2 datas for a couple of documents with a ...
thibault Chevet's user avatar
0 votes
1 answer
128 views

I am trying to get count of likes and if user is liked this post in Mongo. I managed to get this via native query with facets, but problems is how can i map this two fields on my custom java class (...
Evgeny Kuznetsov's user avatar
0 votes
1 answer
671 views

I have a spring-boot project, with spring-data-mongo dependency. Everything is working great. I have a service which basically does a listCollections on one of the DB and clears the content of all the ...
Anirudh Ramesh's user avatar
0 votes
2 answers
853 views

I have a collection: public class Person { private String name; private Integer age; } I want to delete field age in all the documents. So the schema gonna look like that: public class Person { ...
stakeika's user avatar
  • 125
1 vote
1 answer
607 views

Hello I would like use this mongo query in spring to change type fields from string to double: db.getCollection("data").update( { "location.latitude": { $type: 2 }, ...
J.Doe's user avatar
  • 194
3 votes
2 answers
4k views

I'm new in mongodb. Could you please tell me how to perform join operation in this. I've two collection: Collection 1 ("user") { _id: "d04d53dc-fb88-433e-a1c5-dd41a68d7655", ...
Md Enayat's user avatar
  • 167

1
2 3 4 5
9