我的对象结构,
@Data
@Builder
@AllArgsConstructor
@Document(collection = "Book")
public class Book implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private BookKey bookKey;
@Builder.Default
private List<BookType> bookTypes = new ArrayList<BookType>();
private LocalDateTime sourceTimeStamp;
private boolean active;
public Equipment() {
}
public Book(final BookKey bookKey) {
this.bookKey = bookKey;
}
}
public class BookType implements Serializable {
private static final long serialVersionUID = 1L;
private String pageType;
private String bookNumber;
private Set<String> tailNumbers;
}
以下mongo查询无法正常工作。
public Book getBookByPageNumber(final String code, final String pageNumber) {
final Criteria criteria = where("bookKey.code").is(code)
.andOperator(where("bookTypes").in(where("pageNumber").is(pageNumber)));
return mongoOps.findOne(query(criteria), Book.class);
}
页码是唯一的。上面的查询不起作用.pls可以帮助我修复它。 我在执行查询时遇到堆栈溢出异常。