How to get returned data from mongoDB in Perl? How to get returned data from mongoDB in Perl? mongodb mongodb

How to get returned data from mongoDB in Perl?


That's not the official documentation. Head right to the CPAN:

Iterating results is pretty similar to the DBI way:

use Data::Printer;use MongoDB;# no query is performed on initialization!my $cursor = $collection    ->find({ active => 1, country => 'Canada' }) # filter "active" records from Canada    ->sort({ stamp => -1 }) # order by "stamp" attribute, desc.    ->limit(1000);          # first 1000 records# query & iteratewhile (my $row = $cur->next) {    # it is 'p', from Data::Printer!    p $row;}