【发布时间】:2020-04-08 11:01:26
【问题描述】:
例如我有 Java 对象:
public class Foo {
private Example example;
}
public class Example {
private String str1;
private String str2;
}
字段示例可以为空。
我需要获取 str1 包含的所有 Foo 对象,例如“文本”。根据documentation我试过了:
@Query(value = "{ 'example' : { $exists : true, $elemMatch : { str1 : { $regex: '.*?0.*'} } } }")
但它返回空页面。
【问题讨论】:
标签: java spring mongodb mongodb-query