Questions tagged [spring-mongodb]

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

Do not use this. Use instead.

422 questions
0
votes
0 answers

Convert mongo query to Spring

How do I write the following mongoDB query in Spring? db.reportData.aggregate([ { $match : { iecode : {$in:["P110017","P111111"]} } } , { "$group": { "_id": "$iecode", "treatmentArms": { "$first": "$evaluationDTOList" } …
Half Blood Prince
  • 951
  • 2
  • 13
  • 25
0
votes
0 answers

Fetch last inserted record in entire Mongo database

I am using spring mongo data connector and i have some 40 collections in my database. I want to fetch the last inserted record in entire database and not just specific to a collection.
Biscuit Coder
  • 477
  • 4
  • 12
0
votes
1 answer

Configure Spring Boot application to use MongoDB connection uri provided in environment variable

I would like to configure the connection-uri to my MongoDB through an environment variable. This way, I can set different values on localhost or if the Spring Boot application is running in a cloud. I have included mongodb in my build.gradle…
user3105453
  • 1,881
  • 5
  • 32
  • 55
0
votes
0 answers

Aggreagte Mongo Db query to Spring MongoDB

I have same ID testCaseId 'tc1' mapped with 2 requirementId 'req1' and 'req10'. This below query gives the exact match for project--proj001,req--req10 and tc--tc1. I got the solution but unable to convert this query into Spring Mongo.…
Ramya
  • 71
  • 1
  • 1
  • 9
0
votes
1 answer

Spring Mongo criteria query with dates

I have a Product pojo with online and offline date i use the following query to get all the Products where either online date is Null or either offline date is Null . But the following query only returns me when both online and offline date are…
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
0
votes
2 answers

Spring Boot Resource Server not able to authorize roles with oAuth 2 Access Token

I have the following 3 micro-services in place Config Server Auth Server using MongoDB referencing link. I successfully migrated the project from 1.2.4 to 1.3.3 User Service. A Rest Controller and a Resource Server with 3 Get methods.(each for…
0
votes
1 answer

Mongodb Spring Data: Slow query on indexed field?

I was trying to measure how long it took for this simple query to execute: companyRepository.findOne(companyId); // took 300ms Here is the repository class I use: package fn.repository; import…
user1955934
  • 3,185
  • 5
  • 42
  • 68
0
votes
1 answer

Query and Update Mongo Document

The query below increases score by one. db.people.findAndModify({ query: { name: "Andy" }, update: { $inc: { score: 1 } } }) But, is it possible to do more than just increase the score. I would like to, increase the score and also compute…
java_dude
  • 4,038
  • 9
  • 36
  • 61
0
votes
1 answer

MongoDB shard remove data very slow

I found my MongoDB remove data is very slow, but query or insert action is ok. This is my shard status: shards: { "_id" : "shard0000", "host" : "192.168.1.50:27017", "tags" : [ "global" ] } { "_id" : "shard0001", "host" : "192.168.2.50:27017", …
Chi Shin Hsu
  • 261
  • 1
  • 2
  • 12
0
votes
1 answer

how to inject params to mongodb @query

I have query like this @Query(value = "{'statusHistories':{$elemMatch:{'status':{$in:['PROCESSABLE']}}},'created' : { '$gt' : { '$date' : ':#{#dateFrom}' } , '$lt' : { '$date' : ':dateTo'}}}", count = true) Long countMe(@Param("dateFrom") Date…
Przemek85
  • 171
  • 1
  • 1
  • 10
0
votes
2 answers

spring-data-mongodb dependency update issue

Currently I am using Spring-data-mongodb in my project and it works perfectly for me. org.springframework.data spring-data-mongodb 1.1.0.RELEASE I want…
Prashant Thorat
  • 1,752
  • 11
  • 33
  • 54
0
votes
3 answers

Could not initialize class MongoRepositoryConfigurationExtension - MongoDB with Spring 4.2

I am trying to build an app with Spring 4.2, spring-data-mongodb-1.8.0 and spring-data-commons-1.11.0. The following is the exception thrown at runtime. Kindly help. I have been stuck with this for two days. Thanks for your help. Console Log Oct…
0
votes
1 answer

Spring boot application having second datasource failing caching

The presence of a second datasource in a spring boot application is failing caching with the exception: java.lang.IllegalArgumentException: Cannot find cache named 'entity-name' for CacheEvictOperation With one datasource it's working. Both the…
0
votes
1 answer

Setting the Database in MongdoDB-data-REST-complete

I am using the Spring Guide for the MongoDB-data-rest-complete example and I want it to use a specific mongodb database, rather than the default one ('test'). How do I do this?
Peter S
  • 351
  • 1
  • 3
  • 13
0
votes
1 answer

How to group result of mongodb for following data in the given format

I have data in mongodb in following format. i presented below two row of my mongodb data of table named 'feed'. { "_id" : ObjectId("55e80a725ae35bbfc6dce074"), "sourceId" : "12345", "sourceName" : "MyPage", "channelId" : "67890", "channelName" :…