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

never ending cycle, while querying

Open
#4,564 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: feedback-provided
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

  1. it's causing never ending cycle on 3.1.5 - spring boot:

@Query("{profile.$id: :profileId}")
Optional findUserByProfile(@Param("profileId") UUID profileId);

commenting out the query works:

//@Query("{profile.$id: :profileId}")
Optional findUserByProfile(@Param("profileId") UUID profileId);

Not sure, why it's behaving in this way, but it shouldn't blow up any server!

It should override the normal behaviour as default, shouldn't be fiddling with the binding, and call itself 1M times, should throw exception!

  1. the follwing syntax also was working before:
[
    {
        "$match": {
            "$elemMatch": {
                "profiles.$id": {
                    "$in": [
                        ":#{#profileIds}"
                    ]
                }
            }
        }
    }
]

Now, it's neither accepting profiles.$id nor does return back anything

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.

Research direction

Start by reproducing the findUserByProfile repository query on Spring Boot 3.1.5 with the provided @Query and @Param examples, then compare it with the commented-out method and aggregation syntax. Trace the query binding and execution path to identify the cycle; done means the query no longer loops indefinitely and the documented profiles.$id form either works or fails with a clear exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mongodb, spring-boot
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.