mongodb - $in query operator not working in aggregation framework -


i have large collection of dataset, run custom queries using mongo aggregation framework.

i trying following

minlimit , maxlimit date objects specify date range.

tickets.aggregate( { $match: { timestamp: { $gte: minlimit, $lte: maxlimit } } }, { $match: { staffid: { $in: staffids } } }  ).allowdiskuse(true).exec(cb); 

if don't include staff match condition above working fine after include staff match condition no records returned.

the staffids array of ids using lodash pluck method. first staff documents using

staff.find({some filter condition}, callback); 

then pluck each of records using

var staffids = _.pluck(results, '_id'); 

i pass staffids match condition.

  1. why not working? if remove $in match working fine.


Comments