Skip to content

Commit fe66d29

Browse files
committed
sorting at lookup
1 parent ec46631 commit fe66d29

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎handler/activity.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func (h *Handler) GetActivityLogs(ctx *gin.Context) {
4747
skip = 0
4848
}
4949
pipeline := []bson.M{
50+
{"$sort": bson.M{"timestamp": -1}},
5051
{
5152
"$lookup": bson.M{
5253
"from": constants.COLLECTION_STUDENT,
@@ -74,7 +75,6 @@ func (h *Handler) GetActivityLogs(ctx *gin.Context) {
7475
}
7576
pipeline = append(pipeline, bson.M{"$match": matchFilter})
7677
}
77-
pipeline = append(pipeline, bson.M{"$sort": bson.M{"timestamp": -1}})
7878
facetPipeline := append(pipeline, bson.M{
7979
"$facet": bson.M{
8080
"metadata": []bson.M{

0 commit comments

Comments
 (0)