spring-projects / spring-projects/spring-data-mongodb

Project problem with similar names

Open
#4,509 2 comments 0 reactions 1 assignee View on GitHub

@christophstrobl is already working on this.

Since Sep 25, 2023.

type: bug
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Good afternoon, I am currently doing a project where I am using an "aggregation" to do a $lookup, a $unwind and finishing with a $project. To simplify the data and since I don't need all the information that $lookup brings me I use the project to get, , among other things, the id and some fields of the document to which I do $lookup.

The problem comes when I go to see the result of the query and the instance of the class where the data is, doesn't have the correct data.
This is because if the name of the field in the $project has one similar or equal to the one in the value field, this value is not copied and I don't really understand why...

I attach a demo where in the file "TfgBackendApplication.java" you can use debugger to see the fields of an example where one field is wrong and the other is right, although they are also printed on the screen.

I'm sorry if this is a stupid question, but it's really taken me a while to realise this...
demo.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.