How to query mongodb with “like” using the java api?

前端 未结 7 1911
谎友^
谎友^ 2020-12-14 00:59

this question is very similar to another post

I basically want to use the mongodb version of the sql \"like\" \'%m%\' operator

but in my situation i\'m using

相关标签:
7条回答
  • 2020-12-14 01:37

    if(searchType.equals("employeeId")) {

    query.addCriteria(Criteria.where(searchType).regex(java.util.regex.Pattern.compile(searchValue)));

    employees = mongoOperations.find(query, Employee.class, "OfficialInformation"); }

    0 讨论(0)
提交回复
热议问题