I have this helper with a cursor.forEach inside.
Template.profileTags.helpers({
tag:function(){
var tags = tikiTags.find({}).fetch()
var user = tikiUser.find({}).fetch()
//get the user tags
var userTags = user[0].tags
tags.forEach(function(doc, index, array){
//this generates an Exception in template helper: .tag@http://localhost:3000/client/block/profile/profile.js
console.log(userTags)
//this works ok and i get the .tags array
console.log(user[0].tags)
array[index].isActive = "active"
})
return tags
}
})
Why does the first console.log() generate an exception? The second console.log() works but now i'm getting the user's tags 3 times, and that's not very efficient?
thx,