Filter MongoDB Results To Client

Hi guys, I’m just wondering how I can filter results that are pulled from my Meteor Collection just like a layered navigation that you see on many eCommerce websites.

For example I currently have this simple collection:

Vehicles = new Mongo.Collection("vehicles");

if (Meteor.isClient) {
    vehicles: function () {
      return Vehicles.find({});

So this is the type of thing I am trying to achieve:

NOTE: press Filter Results.

I am trying to filter the collection based on the values that each document has in my MongoDB. So if a website user selects ‘Audi’ I would like to show all of the documents with that value in it.

Does anybody have any examples of where this might have been done before?

Thanks, Nick

return Vehicles.find({brand: Session.get('brand')});

And when you change a filter input do a Session.set off course. This works because it’s reactive variable.

Further on you want to look at reactive-dict if you get how this works. That will allow you to writer cleaner code for it.

Btw. you are now doing this on the client. That will work with a limited amount of data. When it becomes more you want to do it in subscribe.

return Vehicles.find({vehicles: this._id});