mongodb - How do I return only unique collection fields from a Meteor collection? -
i have simple to-do app users enter to-do , tag submit. when click tag on left side, displays to-do associated it. filter list on left side unique tags. can't seem find anywhere. help?
this works:
template.all.helpers({ linklist: function() { var = *yourcollection*.find().fetch(); var *youruniquefielditems* = _.pluck(everything,"*yourfield*"); return _.uniq(*youruniquefielditems*); },
the top voted answer here: meteor: how search distinct field values aka collection.distinct("fieldname") similar mongo's doesn't work, author of post found solution himself. unfortunately, it's buried in comments , it's not actual answer.
Comments
Post a Comment