Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MongoDB CPAN distribution.

Maintainer(s)' notes

Please don't report bugs here. Please use the MongoDB Perl driver issue tracker instead.

Report information
The Basics
Id: 66658
Status: resolved
Priority: 0/
Queue: MongoDB

People
Owner: Nobody in particular
Requestors: deflexor [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.42
Fixed in: (no value)



Subject: count and sort_by conflict ?
Hello, i discovered weird bug when using mongo driver. For example i 5 sales and doing simple query: $cursor = $db->sales->query({}, { limit => 10, skip => 0 }); $cursor->count() # returns 5 and its fine, but then i need them sorted, so i changed query and added "sort_by": $cursor = $db->sales->query({}, { limit => 10, skip => 0, sort_by => { created => 1 } }); $cursor->count() # returns 0 ! i think this is not fully correct, because it should return 5 in my opinion. I tried it with stable 1.6.5 and development 1.8rc2 versions of mongodb.
Yes, this was a driver bug. Just fixed in master, will be released in 0.44. In the meantime, you should be able to work around it by doing: my $cursor = $db->sales->find($query)->limit($lim)->skip($skip)->sort($sort); ...instead of putting the sort_by in the query.