I’m trying to get a list of user emails into a variable so i can use with an autoForm. This is really easy to do with templates, but i want it in the JS so i can pass cleanly to an autoForm.
userOptions: function() {
let users = Meteor.users.find({}, { fields: { "emails.address": 1 } });
for (let i=0; i < users.count(); i++) {
console.log(users[i]._id); //this does not work obviously
}
return { //I want to return the id and email like below, the email being the label and the id being the value.
2013: "2013",
2014: "2014",
2015: "2015"
};
Been trying to get this to work for a bit. Just need another pair of eyes to look at it. Please and thank you.
Edit: The plan is to use JSON.stringify once i had the data, but not got there yet.