Skip to content
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

Join Annotation Does Not Change MongoDB Query #3278

Open
SenorPez opened this issue Jan 1, 2025 · 0 comments
Open

Join Annotation Does Not Change MongoDB Query #3278

SenorPez opened this issue Jan 1, 2025 · 0 comments

Comments

@SenorPez
Copy link

SenorPez commented Jan 1, 2025

Expected Behavior

By default, a find query should be generated by the repository interface. According to the documentation (https://micronaut-projects.github.io/micronaut-data/latest/guide/#mongoJoinQueries), using the Join annotation switches to the aggregation pipeline to populate relationship fields.

Actual Behaviour

It doesn't.

@MongoRepository
public interface StarSystemRepository extends CrudRepository<StarSystem, Integer> {
}

and

@MongoRepository
public interface StarSystemRepository extends CrudRepository<StarSystem, Integer> {
    @Override
    @Join("stars")
    @NonNull List<StarSystem> findAll();
}

generates an identical find query.

{"find": "starSystems", "filter": {"_id": {"$eq": 867158537}}, "limit": 1, "singleBatch": true, "$db": "pezdb", "lsid": {"id": {"$binary": {"base64": "qKkxNgeFTdi4SwSSwNvnHA==", "subType": "04"}}}}

The aggregation pipeline is never called, so objects are never populated. Placing the Join annotation in other places (under the Relationship, creating a non-Override interface method, etc.) also never stop the generation of that same find query. The related object is never populated.

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

4.4.4

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

No branches or pull requests

1 participant