Currently facing an issue with the _.pluck function in Meteor. I have successfully set up a subscription to the users collection and confirmed that all users are being fetched by using console.log. However, when attempting to use _.pluck(users, 'username'), I encounter an error message in the console -
TypeError: Cannot read property 'username' of null.
. Below is the code snippet:
MattersController.helpers({
'matterAccess': function(access) {
if (access) {
var users = Meteor.users.find({}, { fields: {'username': 1}});
// console.log(users);
var usernames = _.pluck(users, 'username');
console.log(usernames);
} else {
return;
}
}
});
It's worth noting that the access parameter is returning true.