Answers for "pagination mongodb"

0

pagination mongodb

def skiplimit(page_size, page_num):
        """returns a set of documents belonging to page number `page_num`
        where size of each page is `page_size`.
        """
        # Calculate number of documents to skip
        skips = page_size * (page_num - 1)

        # Skip and limit
        cursor = db['students'].find().skip(skips).limit(page_size)

        # Return documents
        return [x for x in cursor]
Posted by: Guest on April-29-2020
0

mongo paginate

npm install mongoose-paginate-v2
Posted by: Guest on July-17-2021

Browse Popular Code Answers by Language