From 8a55994f6484652e45b4e80d65da8eeea3ddacf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Fern=C3=A1ndez=20Capel?= Date: Wed, 23 May 2018 16:11:28 +0100 Subject: [PATCH] Ensure a team overleaf id is unique --- services/web/app/coffee/models/Subscription.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/models/Subscription.coffee b/services/web/app/coffee/models/Subscription.coffee index 1e9ad71d83..a9ebb7d585 100644 --- a/services/web/app/coffee/models/Subscription.coffee +++ b/services/web/app/coffee/models/Subscription.coffee @@ -19,7 +19,11 @@ SubscriptionSchema = new Schema planCode: String allowed: {type: Boolean, default: true} overleaf: - id: { type: Number } + id: + type: Number + index: + unique: true, + partialFilterExpression: {'overleaf.id': {$exists: true}} SubscriptionSchema.statics.findAndModify = (query, update, callback)->