Skip to content

Instantly share code, notes, and snippets.

@A
Created November 27, 2013 18:28
Show Gist options
  • Save A/7680736 to your computer and use it in GitHub Desktop.
Save A/7680736 to your computer and use it in GitHub Desktop.
exports.get = function(req, res){
User.find(null, 'email -_id', function(err, users) {
if (err) return res.json(500, err);
var retobj = {};
var keys = Object.keys(users);
var i = keys.length;
while (i--) retobj[i] = users[keys[i]] && users[keys[i]].email;
res.json(retobj);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment