Skip to content

Commit

Permalink
Added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MARTIMM committed Feb 12, 2015
1 parent 7aefbcd commit 9184af0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Tests/MongoDB.pl6
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# 1.224u 0.067s 0:01.29 99.2% 0+0k 0+0io 0pf+0w
#

use MongoDB:ver<0.9.4+>;
use MongoDB:ver<0.18.0+>;

my MongoDB::Connection $connection .= new( :host('localhost'), :port(27017));
my MongoDB::Database $database = $connection.database( 'test');
Expand Down Expand Up @@ -75,14 +75,23 @@ $collection.update( :upsert ,
{ '$currentDate' => {'date' => {'$type' => 'timestamp'}}}
);

my $count = $collection.count;
say "There are $count documents";

# Find once
#
show-documents($collection.find({nick => 'ph'}));
my $cursor = $collection.find({nick => 'ph'});
show-documents($cursor);
$count = $collection.count(%(nick => 'ph'));
say "There are $count documents with nick => 'ph', same as cursor.count: "
, $cursor.count;

# Find all
#
show-documents($collection.find());



# Remove all documents.
#
say '-' x 80;
Expand Down

0 comments on commit 9184af0

Please sign in to comment.