我有这个收藏:
{
"_id" : ObjectId("522f05f06f92046814003b84"),
"personal_id" : "0609150071",
"superstructure_id" : 1,
"name" : "David",
"surname" : "Bar",
"plays_often" : 1,
...
"created" : ISODate("2013-09-10T13:43:38Z")
}
{
"_id" : ObjectId("522f05f06f92046814003b84"),
"personal_id" : "0609150071",
"superstructure_id" : 1,
"name" : "David",
"surname" : "Bar",
"plays_often" : 1,
...
"created" : ISODate("2013-09-10T14:11:55Z")
}
...
并需要查找记录:
标准:
superstructure_id: 1
分组依据
personal_id
从这些组中仅返回基于
created
字段的最新记录然后对所有组结果进行排序
plays_often
有限制 5
所以结果将只有这条记录,"personal_id" : "0609150071"
因为在created
:
{
"_id" : ObjectId("522f05f06f92046814003b84"),
"personal_id" : "0609150071",
"superstructure_id" : 1,
"name" : "David",
"surname" : "Bar",
"plays_often" : 1,
...
"created" : ISODate("2013-09-10T14:11:55Z")
}
这在mongodb中可能吗?