我在repo中有一个查询如下,
public class Boo {
EnumType enumType;
}
public class Foo extends Boo {
String id;
}
public interface FooRepository extends MongoRepository<Foo, String> {
Foo findFooById(String id)
}
我需要添加另一个条件来判断字段$exists: false
是否已使用显式@Query
完成--但是否可以在查询方法itslef(可能是findFooByIdAndEnumTypeNotExists
或其他值)中使用它?
public interface FooRepository extends MongoRepository<Foo, String> {
@Query(value="{ id: ?0, enumType: { $exists: false } }")
Foo findFooById(String id)
}