Use index
This commit is contained in:
parent
9bf19d4676
commit
1332adf12b
|
@ -5,12 +5,12 @@ import Reaction from './post-reaction';
|
||||||
import { pack as packUser } from './user';
|
import { pack as packUser } from './user';
|
||||||
|
|
||||||
const PostReaction = db.get<IPostReaction>('postReactions');
|
const PostReaction = db.get<IPostReaction>('postReactions');
|
||||||
|
PostReaction.createIndex(['userId', 'postId'], { unique: true });
|
||||||
export default PostReaction;
|
export default PostReaction;
|
||||||
|
|
||||||
export interface IPostReaction {
|
export interface IPostReaction {
|
||||||
_id: mongo.ObjectID;
|
_id: mongo.ObjectID;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
deletedAt: Date;
|
|
||||||
postId: mongo.ObjectID;
|
postId: mongo.ObjectID;
|
||||||
userId: mongo.ObjectID;
|
userId: mongo.ObjectID;
|
||||||
reaction: string;
|
reaction: string;
|
||||||
|
|
Loading…
Reference in New Issue