Can't get user collections email in props (SOLVED)



I am trying to render a table of the users collection in react. However I can’t get the createdAt date and email to get shown? What am I missing?

This is my code:


This is inside mongo:

meteor:PRIMARY> db.users.find({})
{ "_id" : "fYKbnmKQhnfbFgY2m", "createdAt" : ISODate("2016-10-28T19:18:57.676Z"), "services" : { "password" : { "bcrypt" : "$2a$10$YsOAjbKB9hx3yS.q04UUmOO0b3al0al214xFuWT3RwVjAI4DJmYge" } }, "username" : "John", "emails" : [ { "address" : "", "verified" : false } ] }

Console log is showing this error:

TypeError: Cannot read property '0' of undefined


Are you sure all your users have emails? I would pop a console.log(this.props.user) above those <td> elements and make sure your user objects are populated as you expect. The error is pretty clearly showing that emails is not a property on your user object in this case.


I get this when console logging it:


But how can I still get access to the other properties like email & createdAt?

I am fetching the users prop like this:

  users: Meteor.users.find({}).fetch()



I found out that with the autopublish you only have access to certain user properties. When removing autopublish and creating publish & subscribe you get access to these other fields in the users collection!