【发布时间】:2015-11-26 06:31:41
【问题描述】:
有什么方法可以让我使用一些 spring 数据 CrudRepository 作为 mongodb 查询的结果来获取地图? 这是我的方法,它返回一个对象列表。
Query(value = "db.tweet_replies.aggregate([ {$match: { 'in_reply_parent_tweet_ID' : {$exists : true}}}, {$group: { _id: '$in_reply_parent_tweet_ID', maxDate: {$max : { $cond: [ {$gt : ['authorization_date_time','$user_reply.authorization_date_time']},'$authorization_date_time','$user_reply.authorization_date_time']}}}}])")
List<fReply> findByInReplyParentPostID(final String inReplyParentPostID);
例如它给了我这个结果。
{ "_id" : "638251888450756608", "maxDate" : NumberLong("1441006865000") }
{ "_id" : "637192023661895680", "maxDate" : NumberLong("1440760528000") }
我想将此结果存储为类型化映射而不是对象列表。任何想法 ? .在此先感谢:)
【问题讨论】:
标签: java spring mongodb spring-data