这是我的 mongo 存储库
@Repository
public interface StockRepository extends MongoRepository<Stock,String> {
Stock findStockByStockSymbol(String stockSymbol);
}
这是我的Stock
课
@Document(collection="stocks")
public class Stock {
@Id
private String stockSymbol;
private String StockName;
private Double basePrice;
public String getStockSymbol() {
return stockSymbol;
}
public void setStockSymbol(String stockSymbol) {
this.stockSymbol = stockSymbol;
}
public String getStockName() {
return StockName;
}
public void setStockName(String stockName) {
StockName = stockName;
}
public Double getBasePrice() {
return basePrice;
}
public void setBasePrice(Double basePrice) {
this.basePrice = basePrice;
}
@Override
public String toString() {
return "Stock{" +
"stockSymbol='" + stockSymbol + '\'' +
", StockName='" + StockName + '\'' +
", basePrice=" + basePrice +
'}';
}
}
我正在尝试从列表中获取Stock
列表stockSymbols
stockRepository.findAllStockByStockSymbol(symbolList);
但它返回一个空列表。我究竟做错了什么?