Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
*Location*: https://docs.mongodb.com/manual/reference/operator/aggregation/first/
*User-Agent*: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
*Screen Resolution*: 1920 x 1080
Description
Is it a bug when using sort with group?
Like the example on the page, when performing operation like :
db.sales.aggregate(
[
{ $sort:
},
{
$group:
{
_id: "$item",
firstSalesDate:
}
}
]
)
The operation returns the following results:
{ "_id" : "xyz", "firstSalesDate" : ISODate("2014-02-03T09:05:00Z") } { "_id" : "jkl", "firstSalesDate" : ISODate("2014-02-03T09:00:00Z") } { "_id" : "abc", "firstSalesDate" : ISODate("2014-01-01T08:00:00Z") }But i think the result should be liked :