You have to add the ‘limit’ and ‘sort’ property for finding the data from the MongoDB collection. To perform pagination, you have to combine a limit( ) and one filter pattern. Filter patterns can be createdOn date groups, like say, for instance, createdOnBefore, refer to the following code:
MyModel.find( { createdOn: { $lte: request.createdOnBefore } } )
.limit( 10 )
.sort( '-createdOn' )