From 094384b580ab36feb7e23507aab36d174022ac0c Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 28 Jun 2020 18:57:31 +0300 Subject: feat: only allow feedback once per version --- models/feedback/feedback.model.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'models') diff --git a/models/feedback/feedback.model.ts b/models/feedback/feedback.model.ts index 793f8da..b21747b 100644 --- a/models/feedback/feedback.model.ts +++ b/models/feedback/feedback.model.ts @@ -1,5 +1,7 @@ import { Model, model } from 'mongoose'; import { FeedbackSchema, feedbackSchema } from './feedback.schema'; +feedbackSchema.index({ version: 1, authorId: 1 }, { unique: true }); // Unique together + export default model>('Feedback', feedbackSchema); -- cgit v1.2.3