diff --git a/src/models/favorite.ts b/src/models/favorite.ts index 1ec923c9eb..5f3c328eb1 100644 --- a/src/models/favorite.ts +++ b/src/models/favorite.ts @@ -5,6 +5,7 @@ import isObjectId from '../misc/is-objectid'; import { pack as packNote } from './note'; const Favorite = db.get('favorites'); +Favorite.createIndex('userId'); Favorite.createIndex(['userId', 'noteId'], { unique: true }); export default Favorite; diff --git a/src/models/follow-request.ts b/src/models/follow-request.ts index 02b2a85b9f..50235b8a9d 100644 --- a/src/models/follow-request.ts +++ b/src/models/follow-request.ts @@ -5,6 +5,8 @@ import isObjectId from '../misc/is-objectid'; import { pack as packUser } from './user'; const FollowRequest = db.get('followRequests'); +FollowRequest.createIndex('followerId'); +FollowRequest.createIndex('followeeId'); FollowRequest.createIndex(['followerId', 'followeeId'], { unique: true }); export default FollowRequest; diff --git a/src/models/following.ts b/src/models/following.ts index 58ede35a95..58d55bbeef 100644 --- a/src/models/following.ts +++ b/src/models/following.ts @@ -2,6 +2,8 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; const Following = db.get('following'); +Following.createIndex('followerId'); +Following.createIndex('followeeId'); Following.createIndex(['followerId', 'followeeId'], { unique: true }); export default Following; diff --git a/src/models/note-unread.ts b/src/models/note-unread.ts index 62408d23b6..dd08640d85 100644 --- a/src/models/note-unread.ts +++ b/src/models/note-unread.ts @@ -2,6 +2,8 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; const NoteUnread = db.get('noteUnreads'); +NoteUnread.createIndex('userId'); +NoteUnread.createIndex('noteId'); NoteUnread.createIndex(['userId', 'noteId'], { unique: true }); export default NoteUnread; diff --git a/src/models/note-watching.ts b/src/models/note-watching.ts index b5ef3b61b7..83aaf8ad06 100644 --- a/src/models/note-watching.ts +++ b/src/models/note-watching.ts @@ -2,6 +2,8 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; const NoteWatching = db.get('noteWatching'); +NoteWatching.createIndex('userId'); +NoteWatching.createIndex('noteId'); NoteWatching.createIndex(['userId', 'noteId'], { unique: true }); export default NoteWatching;