Spring数据mongodb查询,默认值嵌入在方法名称中

时间:2016-05-31 11:56:46

标签: spring spring-data-mongodb

是否可以用这种方式编写查询?

public enum Status {SUCCESS, FAIL}

@Document
public class Machine {
  @Id
  private String id;
  private Status status;
  private boolean test;
}

public interface MachineRepo extends MongoRepository<Machine, String> {
  // This is possible !!
  Machine findByTestFalse();

  // Is this possible ?? <-- Here is the question!!
  Machine findByStatusSuccess();
}

0 个答案:

没有答案