SyntaxFix
Write A Post
Hire A Developer
Questions
You can use res.json() to jsonify any object. lean() will remove all the empty fields in the mongoose query.
UserModel.find().lean().exec(function (err, users) { return res.json(users); }