From e52575ab87ae5805a3bb20f0aff3c66b9d8b48f7 Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Mon, 27 Sep 2021 18:09:48 +0200 Subject: [PATCH] api: update mongoose --- api/package.json | 4 ++-- api/src/models/Track.js | 2 +- api/src/routes/api/tracks.js | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/package.json b/api/package.json index e6b0134..1f21a35 100644 --- a/api/package.json +++ b/api/package.json @@ -1,4 +1,4 @@ -{ + { "name": "open-bike-sensor-web-api", "version": "1.0.0", "description": "Backend API for the OpenBikeSensor web app", @@ -40,7 +40,7 @@ "luxon": "^1.26.0", "method-override": "3.0.0", "methods": "1.1.2", - "mongoose": "^5.11.17", + "mongoose": "^6.0.5", "mongoose-data-migrate": "flashstockinc/mongoose-data-migrate", "mongoose-unique-validator": "2.0.3", "morgan": "1.10.0", diff --git a/api/src/models/Track.js b/api/src/models/Track.js index 8e16293..33513c9 100644 --- a/api/src/models/Track.js +++ b/api/src/models/Track.js @@ -148,7 +148,7 @@ class Track extends mongoose.Model { } async generateFilePath() { - await this.populate('author').execPopulate(); + await this.populate('author'); this.filePath = path.join(this.author.username, this.slug); } diff --git a/api/src/routes/api/tracks.js b/api/src/routes/api/tracks.js index 50bb5de..9f6065f 100644 --- a/api/src/routes/api/tracks.js +++ b/api/src/routes/api/tracks.js @@ -310,8 +310,7 @@ router.get( createdAt: 'asc', }, }, - }) - .execPopulate(); + }); return res.json({ comments: req.track.comments.map(function (comment) {