I'm trying to implement an aggregation function I've gotten to successfully work in javascript in perl, but I keep getting the error 'exception: wrong type for field (pipeline) 3 != 4'. Any ideas where I could be going wrong?
my $project = Tie::IxHash->new(
"year" => { '$year' => '$datetime'},
"month" => {'$month' => '$datetime'},
"day" => {'$dayOfMonth' => '$datetime'},
"hour" => { '$hour' => '$datetime'},
# the minute field is being rounded down to the nearest resolution
"minute" => {'$subtract' => (
{'$minute' => '$datetime'},
{'$mod' => ({'$minute' => '$datetime'}, $resolution)}
my $group = Tie::IxHash->new(
_id => { array_serial => '$array_serial',
adaptor_id => '$adaptor_id',
processor_id => '$processor_id',
processor_type => '$processor_type',
{'$project' => $project},
print Dumper(\@pipeline);
my $aggregateCommand = Tie::IxHash->new(aggregate => $collection, pipeline => @pipeline);
my $result = $db->run_command($aggregateCommand);