Problem paggination with bucket pattern

Hello i use bucket pattern for collection , bucket by 10 count

{
    blog_id: 12345,
    created: '2021-10-03'
    posts: [
       {
             post_id: 222,
             text: 'wasd',
             created: '2021-10-10'
       },
       … 
    ],
   post_count: 10,
} 

On site i first show newest(latest) posts 10 count per page. its all okey if buckets full
10 | 10 | 10 | 10

buy late i add new post and created new bucket
1 | 10 | 10 | 10 | 10

now if i take 1 bucket i get 1 post ! but we have more

what is query i should use for take 10 posts if bucket is not full ?

up

do you understand the question?

1 Like

any news ? or this problem havent resolve ?

okey if dont know nothing how resolve this problem can close …

One thing you can try is to always match 2 buckets and then select the first 10 posts after unwind.

Something like the following using your buckets 1,10,101,10

page 0 would select bucket 0 and bucket 1 but display all the post from bucket 0 and posts 0-8 from bucket 1.

page 1 would select bucket 1 and bucket 2 and display post 9 from bucket 1 and posts 0-8 from bucket 2.

page n would select bucket n and bucket n+1 and display post 9 from bucket n and posts 0-8 from bucket n+1