File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,17 @@ export default class MediaDataSource extends MongoDataSource<MediaObject> {
6363 ...toIncludeMediaWithTagsOrNotfilters ,
6464 {
6565 /**
66- * Sort by most recently uploaded media first
66+ * Sort by most recently tags media
6767 */
68- $sort : { createdAt : - 1 , _id : - 1 }
68+ $sort : { updatedAt : - 1 , _id : - 1 }
69+ } ,
70+ {
71+ /**
72+ * Limit the most recent list. While unlikely, it may be
73+ * possible that most recent tags belong to one user.
74+ * We want this number to be large (to pick up more users).
75+ */
76+ $limit : 100
6977 } ,
7078 {
7179 $group : {
@@ -75,6 +83,9 @@ export default class MediaDataSource extends MongoDataSource<MediaObject> {
7583 mediaWithTags : { $push : '$$ROOT' }
7684 }
7785 } ,
86+ {
87+ $sort : { 'mediaWithTags.0.updatedAt' : - 1 }
88+ } ,
7889 {
7990 $limit : safeMaxUsers
8091 } ,
You can’t perform that action at this time.
0 commit comments