Skip to content

Instantly share code, notes, and snippets.

@davisp
Created May 14, 2020 20:42
Show Gist options
  • Select an option

  • Save davisp/6c026cd2ec7a38d7195262f260061c75 to your computer and use it in GitHub Desktop.

Select an option

Save davisp/6c026cd2ec7a38d7195262f260061c75 to your computer and use it in GitHub Desktop.

First request:

POST /dbname/_all_docs/queries?page_size=3


[
    {"start_key": "a", "end_key": "b"},
    {"start_key": "d", "end_key": "e"},
    {"start_key": "q", "end_key": "r"}
]
{"results": [
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": "bookmark1"
        },
        "rows": [
            {"id": "a1", "value": "rev1"},
            {"id": "a2", "value": "rev2"},
            {"id": "a3", "value": "rev3"}
        ]
    },
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": "bookmark2"
        },
        "rows": []
    },
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": "bookmark3"
        },
        "rows": []
    }
]}```

Second Response:

POST /dbname/_all_docs/queries

[ {"bookmark": "bookmark1"}, {"bookmark": "bookmark2"}, {"bookmark": "bookmark3"}, ]


{"results": [ { "total_rows": whatever, "offset": null, "bookmark": { "next": null? }, "rows": [ {"id": "a4", "value": "rev4"} ] }, { "total_rows": whatever, "offset": null, "bookmark": { "next": "bookmark22" }, "rows": [ {"id": "b1", "value": "brev1"}, {"id": "b2", "value": "brev2"} ] }, { "total_rows": whatever, "offset": null, "bookmark": { "next": "bookmark33" }, "rows": [] } ]}```

Third request:

POST /dbname/_all_docs/queries


[
    {"bookmark": "bookmark1"},
    {"bookmark": "bookmark2"},
    {"bookmark": "bookmark3"},
]
{"results": [
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": null?
        },
        "rows": []
    },
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": "bookmark22"
        },
        "rows": [
            {"id": "b3", "rev": "brev3"}
        ]
    },
    {
        "total_rows": whatever,
        "offset": null,
        "bookmark": {
            "next": "bookmark33"
        },
        "rows": [
            {"id": "q1", "rev": "qrev1"},
            {"id": "q2", "rev": "qrev2"}
        ]
    }
]}```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment