diff --git a/src/services/subscription/subscription-router.ts b/src/services/subscription/subscription-router.ts index e8b7a5f..e83e69c 100644 --- a/src/services/subscription/subscription-router.ts +++ b/src/services/subscription/subscription-router.ts @@ -14,7 +14,7 @@ subscriptionRouter.post("/", async (req, res, next) => { // Upsert the user info into the corresponding Subscription collection await Database.SUBSCRIPTIONS.findOneAndUpdate( { mailingList: subscriptionData.mailingList }, - { $push: { subscriptions: subscriptionData.email } }, + { $addToSet: { subscriptions: subscriptionData.email } }, { upsert: true, new: true } ); return res.status(StatusCodes.CREATED).json(subscriptionData);