Search code examples
spring-bootmongorepository

findByParentIdDeletedIsFalse like query in Spring Boot MongoRepository


I know that, in MongoRepository, there are autogenerated queries like findByParentId and findByDeletedIsFalse. I want to get a result that both ByParentId and among them only the field deleted = false ones.

I did my research but not come across with such an example. Is it possible?


Solution

  • Yes , it should be work as

    Considering example where i want to find user who's having email with case insensitive and deleted property set as false

    So only need to combine autogenerated queries with AND operator and pass email as parameter.

    Like :

    findByEmailIgnoreCaseAndDeletedFalse(String email)