0

I've an API in springboot which gets the data from mongo DB. This API accepts 4 filters:

  1. From Date
  2. To Date
  3. Name
  4. Role

Now, the user can send any of the filters or all filters. Example, if he passes just name and role, I should filter the data by name and role ignoring date fields. If he sends all values, I should filter by all fields. If he sends just from date, I should filter by from date ignoring all fields.

Can someone help me with this plesae?

Thank you

1 Answer 1

1

Try Specifications from Spring Data JPA.

Documentation link - https://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.