From 21bacd55dddff10a91a45cad69d34f795b6df34c Mon Sep 17 00:00:00 2001 From: Simon Oulevay Date: Mon, 16 Sep 2024 00:11:21 +0200 Subject: [PATCH] Fix admin reset route --- routes/admin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/admin.js b/routes/admin.js index a62198c..1ea0f75 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -7,13 +7,13 @@ import * as utils from './utils.js'; const router = express.Router(); router.post('/reset', utils.authenticate, function (req, res, next) { - removeAll() + reset() .then(() => res.sendStatus(204)) .catch(next); }); -function removeAll() { - return Movie.remove({}).then(() => Person.remove({})); +function reset() { + return Movie.deleteMany({}).then(() => Person.deleteMany({})); } export default router;