我可以使用MongoDB查询检索字段的不同值,
db.context.distinct("context_name")
结果
["Restaurant", "School"]
我的Mongo集合名是
Context
,文档看起来像,{
"_id" : ObjectId("57ca8a45cadee6167c4d92ba"),
"_class" : "com.something.webappmongo.domain.Context",
"context_name" : "Restaurant"
}
现在我想从spring framework(spring boot 1.4.0)使用这个查询得到结果。我在用吉普斯特。
如何在资源库接口和资源类中实现?
最佳答案
创建存储库方法“finddistinctby[字段]”