odstranil vracanje mongodb id
This commit is contained in:
parent
7651dd290a
commit
580c744c26
@ -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' });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user