我们正在开发一个从 mongoDB 获取数据的项目。我们创建了存储库类,如下所示
@Repository
public interface CustomerRepository extends MongoRepository<Customer,String>{
List<Customer> customers = findByCustomerId(final String customerId);
}
Run Code Online (Sandbox Code Playgroud)
我们希望添加跳过/偏移和限制参数作为 findByCustomerId 方法的一部分。其中 limit 用于定义返回的记录数,skip/offset 定义我们需要获取记录后的记录数。
请帮助我们如何使用 MongoRepository 以最佳方式实现这一点。