mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
Better indexes
This commit is contained in:
parent
a5ee19cc2c
commit
d3d5c89dc8
5 changed files with 9 additions and 0 deletions
|
@ -5,6 +5,7 @@ import isObjectId from '../misc/is-objectid';
|
||||||
import { pack as packNote } from './note';
|
import { pack as packNote } from './note';
|
||||||
|
|
||||||
const Favorite = db.get<IFavorite>('favorites');
|
const Favorite = db.get<IFavorite>('favorites');
|
||||||
|
Favorite.createIndex('userId');
|
||||||
Favorite.createIndex(['userId', 'noteId'], { unique: true });
|
Favorite.createIndex(['userId', 'noteId'], { unique: true });
|
||||||
export default Favorite;
|
export default Favorite;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import isObjectId from '../misc/is-objectid';
|
||||||
import { pack as packUser } from './user';
|
import { pack as packUser } from './user';
|
||||||
|
|
||||||
const FollowRequest = db.get<IFollowRequest>('followRequests');
|
const FollowRequest = db.get<IFollowRequest>('followRequests');
|
||||||
|
FollowRequest.createIndex('followerId');
|
||||||
|
FollowRequest.createIndex('followeeId');
|
||||||
FollowRequest.createIndex(['followerId', 'followeeId'], { unique: true });
|
FollowRequest.createIndex(['followerId', 'followeeId'], { unique: true });
|
||||||
export default FollowRequest;
|
export default FollowRequest;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
|
||||||
const Following = db.get<IFollowing>('following');
|
const Following = db.get<IFollowing>('following');
|
||||||
|
Following.createIndex('followerId');
|
||||||
|
Following.createIndex('followeeId');
|
||||||
Following.createIndex(['followerId', 'followeeId'], { unique: true });
|
Following.createIndex(['followerId', 'followeeId'], { unique: true });
|
||||||
export default Following;
|
export default Following;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
|
||||||
const NoteUnread = db.get<INoteUnread>('noteUnreads');
|
const NoteUnread = db.get<INoteUnread>('noteUnreads');
|
||||||
|
NoteUnread.createIndex('userId');
|
||||||
|
NoteUnread.createIndex('noteId');
|
||||||
NoteUnread.createIndex(['userId', 'noteId'], { unique: true });
|
NoteUnread.createIndex(['userId', 'noteId'], { unique: true });
|
||||||
export default NoteUnread;
|
export default NoteUnread;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import * as mongo from 'mongodb';
|
||||||
import db from '../db/mongodb';
|
import db from '../db/mongodb';
|
||||||
|
|
||||||
const NoteWatching = db.get<INoteWatching>('noteWatching');
|
const NoteWatching = db.get<INoteWatching>('noteWatching');
|
||||||
|
NoteWatching.createIndex('userId');
|
||||||
|
NoteWatching.createIndex('noteId');
|
||||||
NoteWatching.createIndex(['userId', 'noteId'], { unique: true });
|
NoteWatching.createIndex(['userId', 'noteId'], { unique: true });
|
||||||
export default NoteWatching;
|
export default NoteWatching;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue