From 5ce6fa67d212823be43c796e8632b721ede065bb Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 2 Apr 2018 23:19:07 +0900 Subject: Make migration scripts and use createdAt instead of _id --- src/server/api/endpoints/aggregation/users/followers.ts | 4 ++-- src/server/api/endpoints/aggregation/users/following.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/api') diff --git a/src/server/api/endpoints/aggregation/users/followers.ts b/src/server/api/endpoints/aggregation/users/followers.ts index 580d31a3f2..f9a5e8dca8 100644 --- a/src/server/api/endpoints/aggregation/users/followers.ts +++ b/src/server/api/endpoints/aggregation/users/followers.ts @@ -42,10 +42,10 @@ module.exports = (params) => new Promise(async (res, rej) => { for (let i = 0; i < 30; i++) { graph.push(FollowedLog.findOne({ - _id: { $lt: ObjectID.createFromTime(cursorTime / 1000) }, + createdAt: { $lt: new Date(cursorTime / 1000) }, userId: user._id }, { - sort: { _id: -1 }, + sort: { createdAt: -1 }, }).then(log => { cursorDate = new Date(today.getTime()); cursorTime = cursorDate.setDate(today.getDate() - i); diff --git a/src/server/api/endpoints/aggregation/users/following.ts b/src/server/api/endpoints/aggregation/users/following.ts index 3ac0e3a539..b30b1282ba 100644 --- a/src/server/api/endpoints/aggregation/users/following.ts +++ b/src/server/api/endpoints/aggregation/users/following.ts @@ -42,10 +42,10 @@ module.exports = (params) => new Promise(async (res, rej) => { for (let i = 0; i < 30; i++) { graph.push(FollowingLog.findOne({ - _id: { $lt: ObjectID.createFromTime(cursorTime / 1000) }, + createdAt: { $lt: new Date(cursorTime / 1000) }, userId: user._id }, { - sort: { _id: -1 }, + sort: { createdAt: -1 }, }).then(log => { cursorDate = new Date(today.getTime()); cursorTime = cursorDate.setDate(today.getDate() - i); -- cgit v1.2.3-freya