Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Infinite scrolling using express ejs mongodb and nodejs

i want to find 10 results from database and for that i am using this command
db.collections.find().limit(10)
but actually what i want is to also show next 10 results on every click of the client i.e. firstly i want to show 10 documents but if the client demands more documents what command should i use to show next 10 documents after the old 10 documents on every click.

I am using javascript, nodejs, express

A very good source of information is https://www.mongodb.com/blog/post/paging-with-the-bucket-pattern--part-1

I think the bucket pattern only applies if you have huge number of list that doesn’t update. Like IoT logs