Is it possible to pass an object to a Meteor.publish() method?
I have a bunch of checkboxes to filter search results. With each change in the check box I loop through and add all the checked values to an array and then to a session variable. I’m trying to get that into the mongo query and failing miserably at it.
In my Template.onCreated:
self.autorun(function(){
    var filters = Session.get('applyFilters') || null;
    var handle = self.subscribe('frontAllProductsFilter', filters);
    self.ready.set(handle.ready());
});
In my checkbox event map:
    filters = [];
    var out = {};
    // get checked checkboxes values
    $("input:checked").each(function () {
        var id = $(this).attr("id").toString();
        filters.push( id );
    });
    out["color"] = filters;
    Session.set('applyFilters', out);
And finally my publish method (please fogive all the if statements, I’m trying anything at this point!!!
Meteor.publish('frontAllProductsFilter', function(filter){
    if(filter){
        if(filter.color !== undefined && filter.type !== undefined){
            console.log("both filters");
            // need to build this query after I can get a single filter working!
        }
        if(filter.color && filter.color !== "" && filter.type === undefined){
            console.log("only color: "+ filter['color']);
            return Products.find({active: true, color: { $in: filter.color }});
        }
        if(filter.type && filter.color === undefined){
            console.log("only type");
            return Products.find({active: true, type: { $in: filter.type }});
        }
    }else{
        return Products.find({active: true});
    }
});
When I output the filter.color or filter.type it comes back as a string with no quotes…if I have multiple filters selected they are comma separated but with no quotes so I don’t know if it’s being converted as a string or I’m just writing it like that or what is happening. At the end of the day I’m trying to filter my subscription between type and color. The user can select multiples of each so that’s why I’m trying the $in operator if I’m wrong please, please tell me the right way I’m creating quite the dent in my desk by the amount of times I’ve banged my head into it 