express-stormpath
express-stormpath copied to clipboard
Doc example needs updating
https://docs.stormpath.com/nodejs/express/latest/user_data.html#collections
A couple of users have pointed out that our 'Collections' examples that use .each() are not working. For example, the two examples in this subsection throw the error: 'req.stuff.each() is not a function'. They should be tested and updated to something that works, like this:
app.get('/', stormpath.loginRequired, function(req, res) {
req.user.getGroups(function(err, groups) {
if (err) return next(err);
groups.each(function(group, cb) {
console.log(group);
cb();
}, function(err) {
if (err) return next(err);
return res.end();
});
});
});