Skip to main content

All Questions

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
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
0 votes
1 answer
95 views

org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate void using constructor NO_CONSTRUCTOR with arguments

I am using spring data mongo for updating one property by the id using mongo repository methods @Repository public interface CategoryRepository extends MongoRepository<CategoryEntity,Integer> { ...
Rineeth Saladi's user avatar
1 vote
1 answer
237 views

Spring Data Mongo Property Expression Query not returning any results

I have recently started working on a Spring Boot project and chose MongoDB as my database. I have the following Document structure. Following is the User document structure. @Data @Builder(...
nvs87's user avatar
  • 31
0 votes
0 answers
44 views

Better way to store mongo collections details as Java constants

public class MongoDBConstants { // Define the collection names public static final String USER_COLLECTION = "users"; public static final String PRODUCT_COLLECTION = "...
Bharath Tej Chinimilli's user avatar
-1 votes
1 answer
78 views

Optimize mongo $in query

I've a mongo collection having around 550,000 documents. Document has an array field path on which i have a below query in my java code. This field is indexed. Problem is ids in below query can go up ...
Tech_Dev's user avatar
1 vote
0 answers
347 views

Spring data MongoDB (aggregation)

Let's consider the following documents: country{id="1", name="France", cities=[{detail="new_city"}, {from="Paris"}, {from="Lyon"} ]} country{id="...
Adam D's user avatar
  • 47
3 votes
1 answer
53 views

How to lookup in the same document under a collection in MongoDB

I am having below document in MongoDB [UPDATE : Shortened the document] { "sections": [ { "_id": { "$oid": "64cbeb62b669cd29a5719a8f" }...
Pushpak's user avatar
  • 159
1 vote
1 answer
29 views

How to update value in below document in MongoDB

I have below document in MongoDB in which I want to update the 'value' field given the attribute say '64ca0aaa731a2a7284c24c5f here. { "id": "64ca0aaa731a2a7284c24c57", "...
Pushpak's user avatar
  • 159
0 votes
0 answers
38 views

MongoDB Aggregations Java - Efficient distinct count

Let's say I have 'events' collection in MongoDB with millions of documents, and each document in that collection looks something like that: { id: "fg3df23", config_id: "49gjd3s&...
Tom Sisserman's user avatar
0 votes
1 answer
349 views

How can I use Spring Data MongoDB to rename a string field and change it to an array?

I have the following updateMany MongoDB command which renames a field and converts it from a string to a single element array. It's runnable in the MongoDB Shell (mongosh), and uses an aggregation ...
M. Justin's user avatar
  • 18.7k
0 votes
1 answer
335 views

Sorting date field by Day and Month in a MongoDB Query in Spring

I wanted to sort the results of a query by a Date of Birth field, but while storing a garbage year value. This is because, we used to allow birth year, but we do not require it anymore. I am using ...
LaplacesCat's user avatar
0 votes
1 answer
610 views

How to use spring-data-mongodb to implement complex expressions under $substr in Aggregation.project

I have a mongodb query that should be converted to spring-data code. db.collection.aggregate([ { "$project": { "partnerid": 1, "market": { "...
Xavier's user avatar
  • 3
4 votes
1 answer
71 views

mongo how to load nested document by aggregation

I have 3 kinds of document listed as below: vilya_be> db.plots.find({}) [ { _id: ObjectId("6426b069ca83da130cdb7f70"), x: 0, y: 0, _class: 'com.vilya.farm.domain.model....
SoT's user avatar
  • 1,135
1 vote
0 answers
496 views

UncategorizedMongoDbException: 'Invalid $project :: caused by :: Cannot use positional projection in aggregation projection'

I'm getting this error on my service method : org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 31324 with name 'Location31324' and error message 'Invalid $...
Akruti Khandelwal's user avatar

15 30 50 per page
1
2 3 4 5
20