spring-data-mongodb Questions

3

In Spring MVC, I had a @UniqueEmail custom hibernate validator (to check for uniqueness of email when signup), which looked as below: public class UniqueEmailValidator implements ConstraintValidat...
Orobanchaceous asked 12/7, 2018 at 8:9

4

Solved

I am currently writing an application which should use a replica set of MongoDB. It is a Spring Boot based application and the following properties work perfectly fine to connect to one server: sp...
Vinegarroon asked 5/8, 2015 at 18:7

5

Solved

We are working on a project to get data from mongoDB. We have created repository class as below @Repository public interface CustomerRepository extends MongoRepository<Customer,String>{ List...
Batchelor asked 15/4, 2022 at 17:23

13

Solved

I have the following exception when running Java app for MongoDB: [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017 while access...
Brendanbrenden asked 15/2, 2016 at 17:19

4

Solved

I've been started a project with mongodb and spring boot and spring JPA data and I realised I cannot map my data model to entity and make a query on that easily, so I have two questions, My data m...
Parimutuel asked 22/4, 2016 at 12:16

3

Solved

Using spring-data-mongodb-1.5.4 and mongodb-driver-3.4.2 I've a class Hotel public class Hotel { private String name; private int pricePerNight; private Address address; private List<Rev...
Defective asked 10/9, 2017 at 10:49

7

Solved

I want to explore the new transaction feature of MongoDB and use Spring Data MongoDB. However, I get the exception message "Sessions are not supported by the MongoDB cluster to which this client is...
Cerargyrite asked 9/5, 2018 at 13:55

8

Solved

I have a Query with Pageable: Query query = new Query().with(new PageRequests(page, size)) How can I execute it with MongoTemplate ? I don't see a single method returning Page<T>.
Pivot asked 13/3, 2015 at 11:0

14

Solved

The default MappingMongoConverter adds a custom type key ("_class") to each object in the database. So, if I create a Person: package my.dto; public class Person { String name; public Person(Str...
Curmudgeon asked 24/7, 2011 at 23:39

3

I have a test instantiating some entities, saving them to MongoDB and loading them again to make sure the mapping works corretly. I'd like to use the @DataMongoTest annotation on the test class to ...
Tysontyumen asked 7/2, 2017 at 16:13

3

I have a Contract class defined like this: @Document public class Contract { @Id private String id; @Indexed(unique = true) private String ref; private String status = "pending"; // gett...
Seventeen asked 26/4, 2016 at 14:20

1

I am implementing a Spring Data Repository and having my repository extend the MongoRepository. I am looking for a way to specify a hint on my findBy methods so I can be control. I have seen severa...
Pythagorean asked 25/1, 2016 at 22:12

1

Solved

I'm using the Spring-data-mongodb repository framework in my Spring Boot project. I have an API where users can specify 1+ query parameters when searching for an object, and I would like to convert...
Gog asked 24/11, 2023 at 16:24

2

Solved

Using the latest Spring Data Mongo (2.1.1 at time of writing), how do I specify to get the first record of a "custom" query method? Here is an example: @Query(value="{name: ?0, appro...
Cordero asked 24/10, 2018 at 18:29

3

Solved

I'm trying to save a basic document but despite connecting to mongodb successfully... It doesn't seem to want to save. Spring logs 2018-10-03 00:17:25.998 INFO 10713 --- [ restartedMain] o.s.b.d...
Frowzy asked 2/10, 2018 at 11:19

4

I am using MongoDB atlas (cluster) to connect to my spring boot application. I was earlier able to successfully insert & get the data from the cluster but after few minutes of inactivity I star...
Cosh asked 18/4, 2020 at 13:31

3

Solved

We have a simple application in which we have all user in same timezone & therefore we are not interested to store timezone information in mongo date object. Reason for such extreme step is w...

3

In my business logic I have to deal with a lot of entity IDs, all of them of type String, which can cause confusion especially when you pass a couple of them as method parameters. So I thought abou...

5

I'm trying to run some integration test using SpringBoot + Spring Data Mongo + SpringMVC I've simplified and generified the code but it should be able to reproduce the behavior with the following t...
Outandout asked 31/7, 2018 at 21:25

2

how to perform below operation (it is the actual mongo query) using MatchOperation in Spring data mongodb ? $match: { "docs": { $ne: [] } } here docs is an array field and want to check that it ...
Bertine asked 15/5, 2017 at 17:38

5

I'm using Spring-Data for MongoDB: Version information - org.mongodb.mongo-java-driver version 2.10.1, org.springframework.data.spring-data-mongodb version 1.2.1.RELEASE. I have a case that's si...
Conform asked 28/7, 2013 at 16:41

1

Solved

I'm trying to create a Spring Data MongoDB repository method that could perform case insensitive search for fields from a given list, that is functionality similar to SQL 'IN' operator. In my repo...

3

I have the below class as my document. @Data @Builder @Document(collection = "test") public class TestData { @Id private String id; private String name; @Indexed(unique = true) pri...
Messenia asked 9/7, 2020 at 13:44

11

Solved

I know that MongoDB supports the syntax find{array.0.field:"value"}, but I specifically want to do this for the last element in the array, which means I don't know the index. Is there some kind of ...
Refutative asked 23/2, 2015 at 18:3

5

Solved

How would I convert the following MongoDB query into a query to be used by my Java Spring application? I can't find a way to use pipeline with the provided lookup method. Here is the query I am at...

© 2022 - 2024 — McMap. All rights reserved.