From 37080476dc53a88f6f5f96c56b35cba82ec322d6 Mon Sep 17 00:00:00 2001 From: Nicolas Franck Date: Fri, 4 Jun 2021 15:13:10 +0200 Subject: [PATCH] Catmandu::Store::MongoDB#searcher should use attribute start --- lib/Catmandu/Store/MongoDB/Searcher.pm | 1 + t/01-store.t | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Catmandu/Store/MongoDB/Searcher.pm b/lib/Catmandu/Store/MongoDB/Searcher.pm index f32ff60..d8ee144 100644 --- a/lib/Catmandu/Store/MongoDB/Searcher.pm +++ b/lib/Catmandu/Store/MongoDB/Searcher.pm @@ -26,6 +26,7 @@ sub generator { # limit is unused because the perl driver doesn't expose batchSize $c->limit($self->total) if defined $self->total; + $c->skip($self->start) if defined $self->start; $c->sort($self->sort) if defined $self->sort; $c->immortal(1); $c; diff --git a/t/01-store.t b/t/01-store.t index 1ccbd1a..673ec26 100644 --- a/t/01-store.t +++ b/t/01-store.t @@ -66,6 +66,9 @@ is_deeply $store->bag->searcher( is_deeply $store->bag->search(query => {char => "ABC"}, fields => {_id => 1}) ->first, {_id => '789'}; +is_deeply $store->bag->searcher()->to_array(), [{_id => '789', char => 'ABC', num => '123'}]; +is_deeply $store->bag->searcher(start => 1)->to_array(), []; + END { if ($db) { $db->drop;