express-stormpath icon indicating copy to clipboard operation
express-stormpath copied to clipboard

Doc example needs updating

Open mdeggies opened this issue 9 years ago • 0 comments

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();
    });
  });
});

mdeggies avatar Jul 01 '16 23:07 mdeggies