Add unique index

#3946
This commit is contained in:
syuilo 2019-01-21 21:45:11 +09:00
parent 2df2cf0983
commit b44227948d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69

View file

@ -4,6 +4,7 @@ import db from '../db/mongodb';
const PollVote = db.get<IPollVote>('pollVotes'); const PollVote = db.get<IPollVote>('pollVotes');
PollVote.createIndex('userId'); PollVote.createIndex('userId');
PollVote.createIndex('noteId'); PollVote.createIndex('noteId');
PollVote.createIndex(['userId', 'noteId'], { unique: true });
export default PollVote; export default PollVote;
export interface IPollVote { export interface IPollVote {