Uhsac
Uhsac

Reputation: 819

How to add search in meteor todo app example

I try to add a search field in the todo app example of meteorjs, but I don't know how to do it.

I can get the value of the search field with a event but after that I don't know how to filter the "Tasks" collection.

Anyone know how to handle this ?

Thanks

Upvotes: 0

Views: 101

Answers (1)

Seth Malaki
Seth Malaki

Reputation: 4486

Without any fulltext utility, you can use regex on a Collection.find like so:

Tasks.find({text: new RegExp(searchTerm,"ig")});

Upvotes: 1

Related Questions