Calling users from angular to node (MEAN) is sending only email and _id to angular Calling users from angular to node (MEAN) is sending only email and _id to angular mongoose mongoose

Calling users from angular to node (MEAN) is sending only email and _id to angular


To me it seems like this is the problem. When you use find() method in mongoose, It gives an array. so you convert that array into json and send using res.send(). so when you access it using Angular. it may be crashing and not giving the correct format so try changing the code in node js like this. Instead of find() try using findOne() in mongoose like this. I assume you only intend to take one user from this query right ?

// Node.jsrouter.get('/users/all', authenticate, (req, res) => {User.findOne({some query}).select('firstName lastName email').then((user) => {    res.send(user); // there was a typo I changed it too. look in the question not user it was users.});


Try to use res.json("JSON Object"); instead of res.send()..

Else try to check the db using tool like robomongo