0
votes

I am currently trying to query Artifactory for 25 results. So I used:

items.find({"name" : {"$match":"somefile*"}).limit(25)

But I need to get also the Total result for calculate Total results. If there is 500 results, i want to get it also. For Example:

500/25 = 20 pages.

1

1 Answers

1
votes

You can use the search command of the JFrog CLI, with the --count option to only get the number of results.

Or, using AQL through the REST API, you can first query without limit to get the total number of results, by looking at the total count at the range field:

{
    "results" : [
    {
        "repo" : "libs-release-local",
        "path" : "org/jfrog/artifactory",
        "name" : "artifactory.war",
        "type" : "item type",
        "size" : "75500000",
        "created" : "2015-01-01T10:10;10",
        "created_by" : "Jfrog",
        "modified" : "2015-01-01T10:10;10",
        "modified_by" : "Jfrog",
        "updated" : "2015-01-01T10:10;10"
    }
    ],
    "range" : {
    "start_pos" : 0,
    "end_pos" : 1,
    "total" : 1 // <----
    }
}