【问题标题】:criteria query mongodb - spring boot - regex- pattern: start with条件查询 mongodb - spring boot - regex- 模式:以
【发布时间】:2022-01-20 05:21:17
【问题描述】:

我有一个字符串变量 value="System.Ram.*" ,它将用于获取以 System.Ram 开头的任何属性(例如 System.Ram.dell,System.Ram.intel等等)

我想用这样的东西:

Criteria.where(property).regex(pattern_of_value)

谁能帮帮我?谢谢!

【问题讨论】:

    标签: java spring spring-boot criteria-api criteriaquery


    【解决方案1】:

    Criteria.where(property).regex("^System.Ram");

    或者在下面使用(这里value是“System.Ram”):

    Criteria.where(property).regex("^" + value);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-24
      • 2019-10-05
      • 2019-07-07
      • 1970-01-01
      • 1970-01-01
      • 2021-11-21
      • 2017-01-06
      • 1970-01-01
      相关资源
      最近更新 更多