Questions tagged [spring-mongodb]

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

Do not use this. Use instead.

422 questions
0
votes
1 answer

Is this is considered as a transaction in mongodb?

i my application when user try to signup the data he enter from form is saved into two different document public Result schoolSignUp(FormSchoolSignUp signUpForm){ User userEntered=null; if(signUpForm.getEmail()!=null){ User…
ashutosh
  • 81
  • 1
  • 1
  • 9
0
votes
1 answer

Trying to convert mongoDB aggregation query to java aggregation query

I am trying to convert MongoDB Aggregation function to Java Aggregation function. My MongoDB Query is [ { "$match": { "indicesId": "VUSSTAPNETFF" } }, { "$unwind": "$dataSets" }, { "$match": { "dataSets.date": { …
0
votes
0 answers

Spring MongoDB Save

I'm creating a Spring Boot application and I am using AngularJS on the frontend. Upon submitting a form with the appropiate parameters, Spring is supposed to use bookRepository.save() method in order to save the provided data in the MongoDB. The…
0
votes
1 answer

Spring data and mongoDB - aggregation with java list

I have the following document (@Document): @Id private String id; private String fileName; private String projectId; private List documentFileVersions; private List userIdBlackList; // here userIds are included and…
quma
  • 5,233
  • 26
  • 80
  • 146
0
votes
3 answers

Query a document and all of its subdocuments that match a condition in mongodb (using spring)

I have a MongoDB storing data from different sensors. It has the following structure: { "_id" : 1, "sensorName" : "Heart Rate", "samplePeriod" : 1000, "data" : [ { "timestamp" :…
Nas3nmann
  • 480
  • 1
  • 6
  • 13
0
votes
1 answer

Spring JSON Serializer and Deserializer is not getting called

I have written custom serializer and deserializer for com.google.common.collect.Table class. But it is not getting called while persisting that object in MongoDB. I am using Spring 4, Spring-MongoDB 1.9 and Jackson 2.8.4. Below are the class and…
Debopam
  • 3,198
  • 6
  • 41
  • 72
0
votes
1 answer

Spring Mongodb Query ArrayIndexOutOfBoundsException

I have following Spring MongoDB repository class. When I am trying to access this method I am getting following exception. Could you please let me know what's wrong with this one or how to populate Table from JSON? I am using Java 8, Spring 4 and…
Debopam
  • 3,198
  • 6
  • 41
  • 72
0
votes
3 answers

Repository interface saves only last object instance when in a for loop and bulk insert changes objects before saving

I am iterating over a list of objects and saving one object at a time after each loop. What i found is that only the last object is always saved when using the MongoRepository interface. for instance for(int i=0;i<=objectList.size();i++){ …
Rbk
  • 72
  • 1
  • 11
0
votes
0 answers

Not able to get composition pojo values in spring mongo

This is my pojo structure which is having a Map as an instance variable @Document(collection = "notifications") public class PushNotification { private String notificationId; private String title; private String message; private PushType…
0
votes
1 answer

spring custom mongo TokenStore not refresh new access_token automatically when old expired?

I use mongo custom tokenStore and codeService: this is my custom mongoTokenStore: public class MongoTokenStore implements TokenStore { private final MongoAccessTokenRepository mongoAccessTokenRepository; private final…
0
votes
1 answer

How to filter array in Mongodb document using Spring

I have below document structure. { "_id" : { "teacherId" : "", "Year" : "" }, "groups" : [ { "groupId" : "", "groupName" : "", "groupNameLowerCase" : "", …
Sachin
  • 4,621
  • 6
  • 25
  • 31
0
votes
3 answers

How to get selected object only from an array

I have a collection with documents of the following structure: { "category": "movies", "movies": [ { "name": "HarryPotter", "language": "english" }, { "name": "Fana", …
0
votes
2 answers

How to represent a Mongo based NumberLong() in org.springframework.data.mongodb.repository.Query()

I need to fetch records from a MongoDB which has a set of documents. I am using Spring Boot and MongoRepository to do the CRUD operations. I am using a Query annotation to pass my Mongo query.But Spring is unable to parse the query that I have…
0
votes
1 answer

Cannot create index in Azure DocumentDB using Spring MongoTemplate

I just cannot create a desired index. I list existing indexes with System.out.println(mongo.getCollection("User").getIndexInfo()); and still get only [{ "v" : 1 , "key" : { "_id" : 1} , "name" : "_id_1" , "ns" : "devtest01.User"}] I…
Tomasz
  • 988
  • 1
  • 9
  • 23
0
votes
1 answer

Spring cacheable error, trying to cache a user by ID key and evict it the same way

I am trying to cache using spring's @Cacheable. I'm also using spring mongodb. I keep getting the following error: java.lang.IllegalArgumentException: Null key returned for cache operation (maybe you are using named params on classes without debug…
demig0d
  • 1,131
  • 1
  • 12
  • 24