Skip to content

Commit

Permalink
PERL-1078 count_documents should use group with _id: 1
Browse files Browse the repository at this point in the history
  • Loading branch information
xdg committed Mar 29, 2019
1 parent 9ee6a9d commit 905d422
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/MongoDB/Collection.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ sub count_documents {
push @$pipeline, { '$limit', delete $options->{limit} };
}

push @$pipeline, { '$group' => { '_id' => undef, 'n' => { '$sum' => 1 } } };
push @$pipeline, { '$group' => { '_id' => 1, 'n' => { '$sum' => 1 } } };

# possibly fallback to default maxTimeMS
if ( ! exists $options->{maxTimeMS} && $self->max_time_ms ) {
Expand Down

0 comments on commit 905d422

Please sign in to comment.