odstranil vracanje mongodb id

This commit is contained in:
Nikola Petrov 2023-07-12 17:47:32 +02:00
parent 7651dd290a
commit 580c744c26

View File

@ -12,7 +12,7 @@ module.exports = {
* movieController.list() * movieController.list()
*/ */
list: function (req, res) { list: function (req, res) {
MovieModel.find() MovieModel.find({}, {_id: 0, __v: 0})
.then(movies => { .then(movies => {
return res.json(movies); return res.json(movies);
}) })
@ -59,7 +59,7 @@ module.exports = {
}); });
const savedMovie = await movie.save(); const savedMovie = await movie.save();
return res.status(201).json(savedMovie); return res.status(201).json(movie);
} catch (err) { } catch (err) {
return res.status(500).json({ message: 'Error when creating movie' }); return res.status(500).json({ message: 'Error when creating movie' });
} }