Reputation: 173
I need to know about filters using mongo collections using collection fields in meteor.
In my collection there are 3 fields in total:
How to Filter using Staff either selects 'Yes' or 'No' and 'All'?
If selects 'Yes' then only get results from collection in staff field using 'Yes'?
I didn't get any idea about this.So please suggest me what do for this?
Code :
getStaffYesResult: function getStaffYesResult(callback){
console.log('********* getStaffYesResult ************** ');
var filterResult = auth_user.findOne({is_staff:1});//Here get all records is staff true indicates 1 in collection.
console.log('filterResult Length : ' + filterResult.length);
}
Upvotes: 1
Views: 1435
Reputation: 1202
You'll want to use collection.find.
See the official documentation at: http://docs.meteor.com/#/full/find
An example would be:
var find = Person.find({staff: true});
Upvotes: 1