我正在尝试添加mongo存储库查询,该查询将以customerId列表的形式获取提供的所有对象参数
public class Customer {
@Id
private String id;
private String name;
private String customerId;
}
我存储的数据是
[
{
"customerId": "customer1",
"id": "001",
"name": "testName1",
"surname": "testSurname1"
},
{
"customerId": "customer2",
"id": "002",
"name": "testName2",
"surname": "testSurname2"
},
{
"customerId": "customer3",
"id": "003",
"name": "testName3",
"surname": "testSurname3"
}
]
现在,我需要通过传递customerId的列表来检索客户对象
public interface CustomerRepository extends MongoRepository<Task, String> {
List<Customer> findAllByCustomerId(List.of("customer1","customer2","customer4"));
}
期望是,它应该返回客户1和客户2的对象。
非常感谢。