【发布时间】:2020-07-20 23:32:20
【问题描述】:
我正在尝试根据其列出的值查找特定实体。但是以下查询不起作用,有人知道我做错了什么吗?下面的例子?
注意:使用的数据库是mongodb 数据库和模型如下例所示:
Entity1{
name: x
options:[
{
id: 1
key: value1,
someOtherKey: someOtherValues
},
{
id: 2
key: value2,
someOtherKey: someOtherValues2
}
]
}
Entity2{
name: x
options:[
{
id: 4
key: value4,
someOtherKey: someOtherValues4
},
{
id: 5
key: value5,
someOtherKey: someOtherValues5
}
]
}
型号
public class Entity {
private String name;
@DBRef
private List<Option> options;
}
我要获取Entity2,我的参数是,list:
options:[
{
id: 4
key: value4,
someOtherKey: someOtherValues4
},
{
id: 5
key: value5,
someOtherKey: someOtherValues5
}
]
我的仓库:
List<Entity> findByValues(List<Option> options);
【问题讨论】:
标签: spring-boot spring-data spring-data-mongodb