Skip to content

Instantly share code, notes, and snippets.

@nickva
Created February 19, 2025 16:26
Show Gist options
  • Save nickva/712477c68190b0dedd6ebb90a4c8b175 to your computer and use it in GitHub Desktop.
Save nickva/712477c68190b0dedd6ebb90a4c8b175 to your computer and use it in GitHub Desktop.
check purge infos endpoint
#!/bin/sh
# ./dev/run --admin=adm:pass -n1
# "http" is httpie (https://httpie.io)
DB=http://adm:[email protected]:15984
http -q delete $DB/db
http -q put $DB/db
set -x
http -b $DB/db/_purged_infos
# {
# "purged_infos": []
# }
http -b put $DB/db/doc1 a=b
# {
# "id": "doc1",
# "ok": true,
# "rev": "1-4b8a35d3f70a5962f86c6dd06ceb599c"
# }
http -b put $DB/db/doc2 c=d
# {
# "id": "doc2",
# "ok": true,
# "rev": "1-43ca4ac5f035a3057752750224f3c1d1"
# }
http -b post $DB/db/_purge doc1:='["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
# {
# "purge_seq": null,
# "purged": {
# "doc1": [
# "1-4b8a35d3f70a5962f86c6dd06ceb599c"
# ]
# }
# }
http -b post $DB/db/_purge doc2:='["1-43ca4ac5f035a3057752750224f3c1d1"]'
# {
# "purge_seq": null,
# "purged": {
# "doc2": [
# "1-43ca4ac5f035a3057752750224f3c1d1"
# ]
# }
# }
http -b $DB/db/_purged_infos
# {
# "purged_infos": [
# {
# "id": "doc1",
# "revs": [
# "1-4b8a35d3f70a5962f86c6dd06ceb599c"
# ]
# },
# {
# "id": "doc2",
# "revs": [
# "1-43ca4ac5f035a3057752750224f3c1d1"
# ]
# }
# ]
# }
@nickva
Copy link
Author

nickva commented Feb 19, 2025

Example

./purge.sh
+ http -b http://adm:[email protected]:15984/db/_purged_infos
{
    "purged_infos": []
}


+ http -b put http://adm:[email protected]:15984/db/doc1 a=b
{
    "id": "doc1",
    "ok": true,
    "rev": "1-4b8a35d3f70a5962f86c6dd06ceb599c"
}


+ http -b put http://adm:[email protected]:15984/db/doc2 c=d
{
    "id": "doc2",
    "ok": true,
    "rev": "1-43ca4ac5f035a3057752750224f3c1d1"
}


+ http -b post http://adm:[email protected]:15984/db/_purge 'doc1:=["1-4b8a35d3f70a5962f86c6dd06ceb599c"]'
{
    "purge_seq": null,
    "purged": {
        "doc1": [
            "1-4b8a35d3f70a5962f86c6dd06ceb599c"
        ]
    }
}


+ http -b post http://adm:[email protected]:15984/db/_purge 'doc2:=["1-43ca4ac5f035a3057752750224f3c1d1"]'
{
    "purge_seq": null,
    "purged": {
        "doc2": [
            "1-43ca4ac5f035a3057752750224f3c1d1"
        ]
    }
}


+ http -b http://adm:[email protected]:15984/db/_purged_infos
{
    "purged_infos": [
        {
            "id": "doc1",
            "revs": [
                "1-4b8a35d3f70a5962f86c6dd06ceb599c"
            ]
        },
        {
            "id": "doc2",
            "revs": [
                "1-43ca4ac5f035a3057752750224f3c1d1"
            ]
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment