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

MongoDB aggregate variation to match on days difference match

What could be variation of this aggregation to get the result or items where the difference of the days = (a number) and the $acceptedDate is greater than $liveDate - x days AggregationOperation redact = new AggregationOperation() { …
jedgard
  • 868
  • 3
  • 23
  • 41
0
votes
0 answers

Convert mongo query into spring query

MY mongo cli query {$project:{"userId":{$setIntersection:["array1","array2"]}}} I want to convert it into spring aggregation projection. I write following query var intersection=SetOperators.arrayAsSet("array1").intersects("pipe1","pipe2") …
jss
  • 199
  • 2
  • 13
0
votes
0 answers

Spring MongoDB - use abstract/sealed class field

sealed class Entity data class Bacteria( val uid: String, val rank: String, val division: String, val scientificname: String, val commonname: String ): Entity() data class CTDDisease( val diseaseId: String, val name:…
Raghav Mehta
  • 203
  • 2
  • 14
0
votes
2 answers

Mongo aggregrate conditional $match, $group and $project

My collection has document structure like below: { AppName: 'test', AppEnv: 'Development' AppTech:'Java' AppVersion: '1_0', AppName: 'test', AppEnv: 'SQA' AppTech:'Java' AppVersion: '1_0', AppName: 'test22', AppEnv:…
user2262292
  • 129
  • 1
  • 2
  • 9
0
votes
1 answer

Genric Object based query in mongodb

I'm using Spring Data MongoDB and, say want to query the following document: { "id":3, "updatedOn" : ISODate("2018-11-22T10:58:48.536Z"), "totalMaxScore" : 50, "maxAttempts" : 4, "sections" : [ { "sectionName" : "coding", …
user2693135
  • 1,206
  • 5
  • 21
  • 44
0
votes
0 answers

Mongo Spring Projection Query

Hi I am trying to get the below mongo query into spring mongo. I've been trying different ways but I am very fusturated right now. Need help! db.getCollection('rate_review').aggregate([ {$match:{stars:{$exists:true}}}, …
0
votes
0 answers

Cloning MongoDB for running Tests

I have a set of @Tests running in my Spring Boot application that I want to run against a clone of my test Mongo(4.2) database (but against the same Mongo server - copyDatabase is not available). My question is what is the easiest way to make an…
gunygoogoo
  • 641
  • 2
  • 7
  • 19
0
votes
1 answer

Spring Boot : Kotlin & MongoRepository : Performing a full text search

Hi there I am really new to Spring Boot and using Kotlin to learn it (I do Android/iOS professionally etc) I have a basic API setup (Spring Boot, Web, MongoDB etc) and my interface uses MongoRepository I have set up my MongoDB with a full-text index…
Burf2000
  • 5,001
  • 14
  • 58
  • 117
0
votes
1 answer

Spring+Mongo : Handle Connection Timeout

I am connecting to MongoDB with a Spring application. Basic configurations are in a properties file, I have some Mongo configs there. I have a custom Configuration class for MongoDB options to set the timeout limits. When I query for multiple…
0
votes
1 answer

Spring Boot - Mongo | Saving large collection of Objects giving duplicate key error

I have a spring-boot application which has the service to process and save a list of around 100 objects in a go. Everythings seems fine till the processing state but calling save method of MongoRepository throws following…
roger_that
  • 9,493
  • 18
  • 66
  • 102
0
votes
1 answer

Check if all ids exist in repo

I can check if ID exists in my repo using this query: exists(String id); But what query can i use to find out if all elements of a list exist in my repo? Something like this? existAll(List id);
syd
  • 197
  • 12
0
votes
1 answer

Search documents with multiple arrays to check if given values exists in each array in mongoDB

I have a document like Doc1 - { 'category' : [c1,c2] 'location': [l1,l2] } Doc2 - { 'category' : [c1] 'location': [l1] } Doc2 array elements are subelements of Doc1 array. Can I use mongo aggregation query to mark them as…
0
votes
0 answers

How to grab _id in group query in spring mongo aggregation?

So I have this large aggregation query in mongo that I am trying to do in Spring and in one of the aggregation I am doing a group by. Here is the group { $group: { _id: "$transferId", "numTransfers": { "$sum": 1 }, …
0
votes
3 answers

Change default behaviour of mongoTemplate.find

Is there any way to modify every query prepared by mongotemplate.find spring boot 2? I want to modify every find query prepared by spring data mongo find . I want to add custom query after every find query to mongo. How can I achieve that in spring…
0
votes
2 answers

MongoDB get number of matches by $in command

Definition I'm creating searching application and mongo db is used to store searching information. This is example dataset of collection "Resource". { _id:"5b3b84e02360a26f9a9ae96e", name:"Advanced Java", keywords:[ "java", "thread",…
Nishan256
  • 97
  • 7