1

I am trying to show the common field data. I can find the field data.

 Events.find({}, { sort: { createdAt: -1 }}).fetch()
    Like:
    abc
    abc
    xyz

Now I want to show common data like:

abc 
xyz

How can I do this?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
Kane
  • 605
  • 2
  • 8
  • 22
  • @Neil Lunn Thanks! Your suggested answer is resulted showing from the terminal but my code is for the frontend. How to use distinct in frontend for fetch data? – Kane Nov 22 '18 at 04:08
  • 1
    No aggregation methods are supported in the minimongo front end engine, not should they be. Asking for "all data" to be returned to a front end and then working out distinct values is a real design anti-pattern. You can implement [meteor methods](https://guide.meteor.com/methods.html) which can be called from the client, but execute on the back-end and return their data to the client. That is what you should be doing here. – Neil Lunn Nov 22 '18 at 04:32

0 Answers0