我的MongoDB集合中有以下文档:
{
"_id": "someId",
"name": "Some name",
"elements": {
"type": "some type",
"details": {
"value": "Some information:
}
}
}
我需要使用MongoTemplate查询此集合,并按名称和details.value对其进行分组。以下代码不起作用:
Aggregation.group("name", "elements.details.value")
它给了我错误:
com.mongodb.MongoCommandException: Command failed with error 16412 (Location16412): 'FieldPath field names may not contain '.'.' on server
如何在MongoTemplate中正确执行操作?