Skip to content

$looup does NOT work with @DBRef. #4123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ArayChou opened this issue Jul 20, 2022 · 1 comment
Closed

$looup does NOT work with @DBRef. #4123

ArayChou opened this issue Jul 20, 2022 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@ArayChou
Copy link

I write a demo project to demostrate it. https://github.com/ArayChou/DBRefLookupTest . Please run unit test test.QueryTest to produce this issue.

@Document("person") public class PersonPo { @Id private String id; private String name; @DBRef private PersonPo mother; @DocumentReference private PersonPo father; }

AggregationOperation motherLookupDoesNotWork = Aggregation.lookup( "person", "mother.$id", "_id", "mother" );

The above $lookup operation does NOT work. it should work.

And I found a temporary solution, adding a (virtual) field to the document as following, it works.
AddFieldsOperation addMotherId = Aggregation.addFields().addField("motherId") .withValue("$mother.$id") .build(); AggregationOperation motherLookupWorks = Aggregation.lookup( "person", "motherId", "_id", "mother" );

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 20, 2022
@christophstrobl christophstrobl added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 20, 2022
@christophstrobl
Copy link
Member

Thanks for reporting and the sample project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants