api: update mongoose

This commit is contained in:
Paul Bienkowski 2021-09-27 18:09:48 +02:00
parent c7202eadd2
commit e52575ab87
3 changed files with 4 additions and 5 deletions

View file

@ -1,4 +1,4 @@
{ {
"name": "open-bike-sensor-web-api", "name": "open-bike-sensor-web-api",
"version": "1.0.0", "version": "1.0.0",
"description": "Backend API for the OpenBikeSensor web app", "description": "Backend API for the OpenBikeSensor web app",
@ -40,7 +40,7 @@
"luxon": "^1.26.0", "luxon": "^1.26.0",
"method-override": "3.0.0", "method-override": "3.0.0",
"methods": "1.1.2", "methods": "1.1.2",
"mongoose": "^5.11.17", "mongoose": "^6.0.5",
"mongoose-data-migrate": "flashstockinc/mongoose-data-migrate", "mongoose-data-migrate": "flashstockinc/mongoose-data-migrate",
"mongoose-unique-validator": "2.0.3", "mongoose-unique-validator": "2.0.3",
"morgan": "1.10.0", "morgan": "1.10.0",

View file

@ -148,7 +148,7 @@ class Track extends mongoose.Model {
} }
async generateFilePath() { async generateFilePath() {
await this.populate('author').execPopulate(); await this.populate('author');
this.filePath = path.join(this.author.username, this.slug); this.filePath = path.join(this.author.username, this.slug);
} }

View file

@ -310,8 +310,7 @@ router.get(
createdAt: 'asc', createdAt: 'asc',
}, },
}, },
}) });
.execPopulate();
return res.json({ return res.json({
comments: req.track.comments.map(function (comment) { comments: req.track.comments.map(function (comment) {