Skip to main content

Questions tagged [spring-data-mongodb]

Spring Data for MongoDB is part of the Spring Data project which provides a familiar and consistent Spring-based programming model for new datastores while retaining store-specific features and capabilities. The Spring Data MongoDB project provides integration with MongoDB document database. Key functional areas of Spring Data MongoDB are a POJO centric model for interacting with a MongoDB Collection and easily writing a Repository style data access layer.

spring-data-mongodb
-2 votes
0 answers
13 views

GridFS creating orphan chunks when using unique index [closed]

I have a unique index on one of the metadata fields in .files collection which is needed in my case to stop duplicate uploads into GridFS. In my testing I have found that when a file with duplicate ...
hsb's user avatar
  • 25
0 votes
0 answers
14 views

Spring Boot: Integration tests using Testcontainers fail when using spring.data.mongodb.uri property, but work when using spring.data.mongodb.user etc

I have a set of working integration tests with Testcontainers and MongoDB container. As part of the test, an data import is done when running tests. For this, I've written a configuration class: @...
Christoph Dahlen's user avatar
0 votes
1 answer
60 views

How to use mongodb Aggregation.addFields() reduce? [closed]

I want to convert the following code into spring data mongodb code. [ { $addFields: { children: { $reduce: { input: "$children", initialValue: { ...
SageJustus's user avatar
0 votes
1 answer
30 views

Error creating bean with name 'mongoMappingContext'

i'm getting this error when i'm trying to run my springboot app: reationException: Error creating bean with name 'mongoMappingContext' defined in class path resource [org/springframework/boot/...
NasusCoder's user avatar
0 votes
1 answer
44 views

The field 'idFields' must be an accumulator object

I am trying to use Spring Data Mongo to take the average of some fields in a collection of documents. I have a pipeline that searches via at Atlas search and then a group stage that performs the ...
Kramer's user avatar
  • 989
0 votes
0 answers
17 views

spring-data-mongodb v3.4.18 with mongodb-driver-sync v4.6.1 slow insertDocument() performance on MongoDB V-5.0 server

I have Spring v-5.3.36 with backend MongoDB server v5.0. The problem is that if I use spring-data-mongodb v3.4.18 with mongodb-driver-sync v4.6.1 driver combination, the MongoRepository.insert(doc) ...
Herbert Wu's user avatar
0 votes
0 answers
38 views

Spring Data MongoDB Aggregation - Invalid Reference Error

I am working on a Spring Data MongoDB Aggregation Pipeline. The pipeline has multiple stages (match, unwind, project, group, addFields, etc.). At all these stages, I just pass (totally undisturbed) an ...
Narayan Jee Jha's user avatar
0 votes
0 answers
36 views

How to sort mongo aggregation by month and year

I am trying to group, sum and sort data by date created in the format %m%Y. The problem I am facing is that aggregation result is sorted by month only without year, so I get something like: 012024, ...
Charles Moga's user avatar
1 vote
0 answers
29 views

Why DefaultProjectionInformation.collectDescriptors() ignoring Default methods?

I wonder what is the reason of ignoring default methods when getting descriptors for DefaultProjectionInformation I'm using spring-data-mongodb. When I try to execute a query with projection: // ...
requizm's user avatar
  • 53
0 votes
1 answer
53 views

ConditionalOperators return null in else case throws exception

I have below code to map the fields with projection. private static ProjectionOperation getProjectionOperation() { Cond conditional = ConditionalOperators.when(Criteria.where("...
madhuri's user avatar
  • 125
0 votes
1 answer
30 views

Method defined in Custom Repository Implementation is not being recognized (Property Reference Exception)

This question is related to Custom Repository Implementation I have created a custom repo public interface CustomTransactionRepo<TEntity> { List<TEntity> basicSearch(String searchQuery,...
Ansh Raina's user avatar
0 votes
0 answers
31 views

My project stopped adding, updating and deleting (Spring + MongoDB)

I have a project using SpringBoot and MongoDB. At some point it stopped working and is showing the following logs: 2024-05-22T11:50:26.046-03:00 2024-05-22T11:50:26.048-03:00 2024-05-22T11:50:26.075-...
JoseNetinho's user avatar
0 votes
0 answers
33 views

How to convert this mongo shell to java

I'm trying to convert this mongo shell to Mongotemplate, but I can't find any way to do it. Here is the shell: db.userCustomSetting.deleteMany({ $expr: {$regexMatch: {input: { $toString: "$...
王大锤's user avatar
2 votes
2 answers
70 views

Type Mapping - Spring Data MongoDB

We have the use case that we’re storing deeply nested objects in MongoDB. Certain fields in this object can have different types. For instance let’s say an object can have a field that’s a collection ...
Ranil Wijeyratne's user avatar
0 votes
0 answers
32 views

Spring Data MongoDB + SPEL aggregation issue

I have an aggregation in a Spring Data MongoDB repository, using @Aggregation annotation. Method has optional parameters, so I use SPEL to check input for nullability. My question is: what is wrong ...
Yevhenii Filatov's user avatar

15 30 50 per page
1
2 3 4 5
221