<template name="listAll">
{{#each user}}
{{_id}}
{{username}}
{{emails.address[0]}}
{{/each}}
</template>Template.listAll.helpers({
user: function(){
return Meteor.users.find();
}
});
Meteor.users.find() Meteor.users.find().count()<template name="listAll">
{{user}}
</template>if (Meteor.isClient) {
Meteor.subscribe('allUsers')
}
if (Meteor.isServer) {
Meteor.publish('allUsers', function() {
return Meteor.users.find({}, {fields:{username:1,emails:1}})
})
}Meteor.users.find().count(){{#each user}}
{{emails}} <<----- returns [Object object]
{{emails.address}} <<------ returns nothing
{{emails.address[0]}} <<------ Makes meteor poop itself.
{{/each}}> Meteor.users.find()
< Object
_selectorId: undefined
_transform: null
>collection: Object
fields: undefined
limit: undefined
>matcher: Object
reactive: true
skip: undefined
sorter: null
>__proto__: Object> Meteor.users.findOne()
< Object
_id: "cZjCoDHgBe9ma2nA9"
>emails: Array[1]
username: "Meema"
>__proto__: Object
emails[0].addressException from Tracker recompute function: Can't call non-function: [object Object]
... (it goes on... I am just shortening it here for sake of brevity)
Exception in queued task: http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2525:37
nonreactive@http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:502:13
addedAt@http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2510:28
addedAt@http://localhost:3000/packages/observe-sequence.js?2fd807ea171ead273b9e6458607cb226012d9240:339:26
addedBefore@http://localhost:3000/packages/minimongo.js?9adf0102ce60b3df01914155826e1661f636e91d:3839:35
addedBefore@http://localhost:3000/packages/minimongo.js?9adf0102ce60b3df01914155826e1661f636e91d:3776:60
http://localhost:3000/packages/minimongo.js?9adf0102ce60b3df01914155826e1661f636e91d:420:18
runTask@http://localhost:3000/packages/meteor.js?61916b1060b33931a21f104fbffb67c2f3d493c5:688:12
flush@http://localhost:3000/packages/meteor.js?61916b1060b33931a21f104fbffb67c2f3d493c5:716:17
drain@http://localhost:3000/packages/meteor.js?61916b1060b33931a21f104fbffb67c2f3d493c5:724:17
insert@http://localhost:3000/packages/minimongo.js?9adf0102ce60b3df01914155826e1661f636e91d:628:27
update@http://localhost:3000/packages/mongo.js?9bc2c5a8b2796fab86b51660ca643e5a49a30c84:252:34
http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:3908:53
http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:4658:25
forEach@[native code]
forEach@http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:18
http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:4657:17
forEach@http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:26
_livedata_data@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:4654:13
onMessage@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:3714:26
http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:2713:19
forEach@[native code]
forEach@http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:156:18
onmessage@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:2712:15
dispatchEvent@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:152:27
_dispatchMessage@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:1137:23
_didMessage@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:1195:34
onmessage@http://localhost:3000/packages/ddp.js?1f971b2ac9f4bdab7372cb5098ed1e26ff98dfb2:1342:28--
You received this message because you are subscribed to a topic in the Google Groups "meteor-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/meteor-talk/TrMjDDaThbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to meteor-talk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meteor-talk/a3dc5023-ba9a-40f9-836a-87cf2566610c%40googlegroups.com.
Template.listUs.helpers({
user: function(){
return Meteor.users.find();
}
});
Template.listUs.helpers({
userEmail: function(){
return this.emails[0].address;
}
});<template name="listUs">
{{#each user}}
{{userEmail}}
{{/each}}
</template>Template.adminMod.helpers({
user: function(){
return Meteor.users.find();Template.listUs.helpers({
user: function(){
return Meteor.users.find();
}
});
Template.listUs.helpers({
userEmail: function(){
return this.emails[0].address;
}
});<template name="listUs">
{{#each user}}
{{username}} {{userEmail}} <br>
{{/each}}
</template>Sounds like you haven't published that data.. still relying on auto publish to publish the data? In which case you would only have the email address for the current logged in user.
--
You received this message because you are subscribed to a topic in the Google Groups "meteor-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/meteor-talk/TrMjDDaThbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to meteor-talk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meteor-talk/e759bd48-b13e-47a9-940d-ea1045eedf17%40googlegroups.com.
Meteor.publish('allUsers', function(){
return Meteor.users.find({}, {fields: {username: 1, emails: 1}})
}); Meteor.publish('allUsers', function(){
return Meteor.users.find({}, {fields: {username: 1, emails: 1, profile: 1}})
});
// Inside a template helper:
var Ul = Meteor.users.findOne({_id: this._id});
console.log(U);>Object
_id: "A3KpDzrf3TvkvFBNS"
>emails: Array[1]
username: "testing2"
__proto__: Object
accounts.js:56