Questions tagged [spring-mongodb]

Do not use this. Use [spring-data-mongodb] instead.

Do not use this. Use instead.

422 questions
49
votes
5 answers

INFO warnings about multiple modules in Spring Boot, what do they mean?

I recently bumped up my spring boot version to 1.4.0. Now I see the following warnings below. I am using spring-mongodb and spring-redis (strictly for caching). Is this something I should be concerned about? Multiple Spring Data modules found,…
demig0d
  • 1,131
  • 1
  • 12
  • 24
20
votes
2 answers

Spring Boot 2.3.0 - MongoDB Library does not create indexes automatically

I've provided a sample project to elucidate this problem: https://github.com/nmarquesantos/spring-mongodb-reactive-indexes According to the spring mongo db documentation…
nmmsantos
  • 315
  • 1
  • 6
  • 15
19
votes
3 answers

Spring Mongo DB @DBREF

I am having trouble writing code that would allow get a user and claim details in a straightforward way. This is my MongoDB structure, db.user.find(); user: { "name" : "KSK", "claim" :…
KSK
  • 636
  • 1
  • 9
  • 29
19
votes
1 answer

No property null found on entity class java.time.ZonedDateTime to bind constructor parameter to

I have the following configuration Configuration @Configuration @EnableMongoRepositories(basePackages = Constants.DATA_SCAN) @EnableMongoAuditing(auditorAwareRef = "auditorAwareService") @Import(value = MongoAutoConfiguration.class) public class…
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
15
votes
2 answers

How to update particular field in mongo db by using MongoRepository Interface?

How to update a particular field in mongo db collection by using MongoRepository Interface in spring?
Anil
  • 191
  • 1
  • 2
  • 11
14
votes
2 answers

mongodb mongoTemplate get distinct field with some criteria

My MongoDB json structure is { "_id" : "122134231234234", "name" : "Total_pop", "description" : "sales category", "source" : "public", "dataset" :"d1" }, { "_id" : "1123421231234234", "name" : "Total_pop", …
Raj
  • 143
  • 1
  • 1
  • 6
13
votes
2 answers

Calculated group-by fields in MongoDB

For this example from the MongoDB documentation, how do I write the query using MongoTemplate? db.sales.aggregate( [ { $group : { _id : { month: { $month: "$date" }, day: { $dayOfMonth: "$date" }, year: { $year: "$date" }…
12
votes
0 answers

Spring Mongo DB @DBRef(lazy=true) - How to lazy Load

I have a model like the one below (assume as pseudo code ) class Student { @Id private String id; private String firstname; .....; @DBRef(lazy=true) private College college // getters and setters } class College { …
11
votes
2 answers

How to merge two matching objects from different array into one object?

I have a situation where I have got one result from aggregation where I am getting data in this format. { "_id" : ObjectId("5a42432d69cbfed9a410e8ad"), "bacId" : "BAC0023444", "cardId" : "2", "defaultCardOrder" : "2", "alias" :…
John Maclein
  • 1,034
  • 3
  • 13
  • 24
9
votes
2 answers

spring mongo querydsl Can't find a codec for class java.time.LocalDateTime

I use spring mongo data rest and querydsl the domain: has a property: @DateTimeFormat(iso = ISO.DATE_TIME) private LocalDateTime registerTime; To use Json ,I add : jackson-datatype-jsr310 the LocalDateTime can work…
Kery Hu
  • 5,626
  • 11
  • 34
  • 51
8
votes
1 answer

Disable create collection in spring data mongoDB

Can someone tell me how do I configure spring data mongoDB in such a way that it does not create a new collection(if it does not exist) but throws an exception while inserting a document?
Rakesh
  • 466
  • 3
  • 12
7
votes
0 answers

org.springframework.data.mapping.PreferredConstructor$Parameter@2514e415 does not have a name! (Spring data mongo converters)

I have this json in my Mongo collection(as field of main object): "dateOfBirth" : { "year" : 1953, "month" : 4, "day" : 26 } And I have this Java class for mapping: @Data public class LocalDate { private Integer…
7
votes
2 answers

Spring MongoDB Data elemMatch Simple

{ _id: 1, results: [ "tokyo", "japan" ] } { _id: 2, results: [ "sydney", "australia" ] } db.scores.find( { results: { $elemMatch: { $regex: *some regex* } } } ) How do you convert this simple elemMatch example using spring mongodb data Query…
user1955934
  • 3,185
  • 5
  • 42
  • 68
7
votes
1 answer

Configuring flapdoodle embedded mongo with Mongodb version 4 and replica

I am currently working on a spring boot application 2.0.3.RELEASE. I want to configure Flapdoodle MongoDb with MongoDb version 4.0 and I also want to set a single mongo instance and create replicas for it. So far i haven't figured out the process…
user2083529
  • 715
  • 3
  • 13
  • 25
7
votes
3 answers

Spring Mongo > How to get list AggregationOperations from Aggregation

I have a function that receive an Aggregation aggregation as a param. I would like to get all AggregationOperation from aggregation. Is there any way to do it? public Aggregation newCustomAggregation(Aggregation aggregation, Criteria c) { // How…
taile
  • 2,738
  • 17
  • 29
1
2 3
28 29