Kindly help me in Distinct Query

i want distinct data from my collection kindly help me in that query and it is not giving that data

return Routinemaster.find({}).distinct(‘name’, true);

Collection.find().distinct does not exist. Also minimongo (client side) does not implement distinct. You need to run it on the server

  distinctRoutinemaster: function() {
   return Routinemaster.distinct('name');

if(Meteor.isClient)'distinctRoutinemaster', function(err,res) {
  if(err) console.error(err);
  else console.log(res);

or you can use package mrt:mongodb-aggregation which implements this for you

dear it is generating error see it kindly solution of it

TypeError: Object [object Object] has no method ‘distinct’

you need to access collection in raw mode.

Look into using the monbro:mongodb-mapreduce-aggregation package (it’s a bug fixed / more recently maintained fork of mrt:mongodb-aggregation).

no need for packages

Very true - I’m just recommending a package as an alternative (that has some other benefits as well).

raw mode can you explain it please a little bit

Try this

  distinctRoutinemaster: function() {
   var raw = Routinemaster.rawCollection();
   var distinct = Meteor.wrapAsync(raw.distinct, raw);
   return distinct('name');

this is working i want not only name but also all values associated with name distinct fields how can i??