From 97c4758de21c3eb0ba36cbeb8d50281ccd485ba2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 14 May 2018 13:58:44 +0900 Subject: [PATCH] Use _id instead of createdAt to improve performance --- src/server/api/endpoints/notes/trend.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/server/api/endpoints/notes/trend.ts b/src/server/api/endpoints/notes/trend.ts index cb3912dc48..4735bec51e 100644 --- a/src/server/api/endpoints/notes/trend.ts +++ b/src/server/api/endpoints/notes/trend.ts @@ -38,12 +38,8 @@ module.exports = (params, user) => new Promise(async (res, rej) => { if (pollErr) return rej('invalid poll param'); const query = { - createdAt: { - $gte: new Date(Date.now() - ms('1days')) - }, - renoteCount: { - $gt: 0 - }, + _id: { $gte: new Date(Date.now() - ms('1days')) }, + renoteCount: { $gt: 0 }, '_user.host': null } as any;