0
我在我的mongodb集合中收集了新聞。Spring Boot MongoDB通過列表中的值查找記錄
{
"_id" : ObjectId("593a97cdb17cc6535522d16a"),
"title" : "Title",
"text" : "Test",
"data" : "9.06.2017, 14:39:33",
"author" : "Admin",
"categoryList" : [
{
"_id" : null,
"text" : "category1"
},
{
"_id" : null,
"text" : "category2"
},
{
"_id" : null,
"text" : "category3"
}
]
}
每個新聞記錄都有類別列表。我很想找到所有有category1
的新聞categoryList
我試着做到這一點 newsRepository.findByCategoryList("category1");
但不工作。
如何做到這一點?