如何在 Play 框架中使用分页

How to use pagination in Play framework

我正在使用 angularJS、Play 框架、Java 和 Mongo Db,帮我实现服务器端分页

您必须在 MongoDB 中使用 limit() 和 skip()。

示例:我有用户集合。

db.getCollection('users').find({}).limit(10).skip(0)

你必须通过你的 URL 和 ?limit=10&offset=0 就像 https://domain/api/users?limit=10&offset=0

您必须在 skip() 中使用偏移量。

limit() 是针对您在页面中显示的记录数。 skip() 用于记录跳过