spring-projects / spring-projects/spring-data-mongodb
Add static method to create OR criterion.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Currently the only way to create an $or only query is counter intuitive and leads people to creating $and combined criterions to a single element $or as outlined below.
query(where("title").is(...).orOperator(where("content").is(...))
{
"title": ...,
"$or": [
{
"content": ...
}
]
}
The correct, rather cumbersome usage would be as follows:
query(new Criteria().orOperator(where("title").is(...), where("content").is(...)))
Introducing a static or(Critieria... criterions) method would allow for simpler usage
query(or(where("title").is(...), where("content").is(...)))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Criteria class and its existing orOperator API, then review nearby tests for criteria construction. Done means the requested static or(Criteria... criterions) entry point supports the simpler query form shown in the issue and is covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100