Q:

Search multiple field in MongoDB with MeteorJS

I am beginner in programming and interested to learn MeteorJS.  I want to search category_name and subcategory_name by keyword or alphabet.:) 
This is my code. 
collections: subcategory
{
    _id:"ZbwCsJEMi2DesyJA7",
    category_name: "ICT",
    subcategory_name: "Laptop"
}

subcategory.js

Template.Subcategory.events({
     "keyup .searchbox": function(event){
           var query = event.target.value;
           Session.set('query', query);
     }
});

Template.Subcategory.helpers({
     subcategory: function(){
         var filter = {sort: {}};
         var query = Session.get('query');
         filter.sort[Session.get('sortby')] = 1;
         return Subcategory.find({ subcategory_name: new RegExp(query, 'i')} , filter ); 
    }
});

A:

Seems like you are looking for $or operator:
var queryRegexp = new RegExp(query, 'i');

return Subcategory.find({
    $or: [
        { category_name: queryRegexp },
        { subcategory_name: queryRegexp }
    ]
} , filter);

Official Mongo's documentation for $or: https://docs.mongodb.org/manual/reference/operator/query/or/

