目前我在春天使用mongoDB作为mongoTemplate。我有2个问题 1.如何在mongoTemplate中执行原始查询 2.如何在单个文档中使用mongoTemplate在数组中找到匹配的对象
按照createDate排序后,这是我要获取的文件。其中电影数组包含对象。我想从这个已排序的文档中获取匹配的对象。来自整个集合 例如:
{
"category": "movies",
"movies": [
{
"name": "HarryPotter",
"language": "english"
},
{
"name": "conjuring",
"language": "english"
},
{
"name": "Fana",
"language": "hindi"
}
],
"createDate" : ISODate("2016-11-4T14:57:12.750+0000")
}
if movies.language is english in query
excepted OutPut:
{
"category": "movies",
"movies": [
{
"name": "HarryPotter",
"language": "english"
},{
"name": "conjuring",
"language": "english"
}
]
}