Meteor-Community-Packages / meteor-autocomplete

Client/server autocompletion designed for Meteor's collections and reactivity.
https://atmospherejs.com/mizzao/autocomplete
MIT License
350 stars 109 forks source link

Distinct entries #114

Open sarita-dc opened 8 years ago

sarita-dc commented 8 years ago

I want to fetch distinct entries from the field. Is there any option where I can avoid duplicate entries?

developeron29 commented 8 years ago

+1

Yonben commented 8 years ago

+1

mizzao commented 8 years ago

This is best done in the logic that populates the collection you give to autocomplete, and not handled by the package itself.

Perhaps you can try publishing a collection.distinct() query from the server, for example.

Yonben commented 8 years ago

@mizzao Maybe there's a way I don't see because of my lack of experience, but collection.distinct() returns an array not a cursor, so I can't integrate it with the auto-complete, as it asks for a collection.

mizzao commented 8 years ago

Yeah, you'd have to do some more legwork to get it from the raw Mongo query, over a publication, into a collection on the client :)

Yonben commented 8 years ago

I see, thanks a lot !

2016-02-10 17:56 GMT+02:00 Andrew Mao notifications@github.com:

Yeah, you'd have to do some more legwork to get it from the raw Mongo query, over a publication, into a collection on the client :)

— Reply to this email directly or view it on GitHub https://github.com/mizzao/meteor-autocomplete/issues/114#issuecomment-182443492 .