【问题标题】:Cloudant DB api supports pagination?Cloudant DB api 支持分页吗?
【发布时间】:2015-10-16 07:19:19
【问题描述】:

我有一个应用程序已经使用cloudant.synch.query.IndexManager 来查询数据库。但我需要分页。我可以看到 Cloudant 通过使用书签来支持它,但我只能找到关于使用 HTTP Post 到 url 路径的文档:/db/_findIndexManager 中的方法没有书签。有没有我可以使用的 cloudant api,而不是做 http 帖子?

我的应用程序是使用 IBM Bluemix MobileFirst 服务作为后端的 Android 和 iOS 应用程序。我正在使用 bms_samples_android_bluelist(https://github.com/ibm-bluemix-mobile-services/bms-samples-android-bluelist)as 一个例子。

【问题讨论】:

    标签: pagination ibm-cloud ibm-mobilefirst cloudant


    【解决方案1】:

    使用 Skip 和 Limit 进行分页。

    我从 Cloudand Synch 文档 https://github.com/cloudant/sync-android/blob/master/doc/query.md 得到这个

    跳过和限制

    跳过和限制允许检索结果的子集。除此之外,这在分页中很有用。

    skip 跳过结果集中的一些结果。 limit 定义为查询返回的最大结果数。 要显示第 21 到第 30 个结果:

    QueryResult 结果 = im.find(query, 20, 10, fields, null); 禁用:

    跳过,传递 0 作为跳过参数。 限制,传递 0 作为限制参数。

    【讨论】:

      【解决方案2】:

      是的! Cloudant 用于 Android 和 iOS 的本机移动库被称为“Cloudant Synch”。大部分资源都编译在这个页面上:https://cloudant.com/cloudant-sync-resources/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-27
        • 2012-03-17
        • 1970-01-01
        • 2020-09-14
        • 1970-01-01
        • 1970-01-01
        • 2016-02-19
        • 1970-01-01
        相关资源
        最近更新 更多