Display Limits and Pagination

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

Limitation

Sort, limit , and offset elements only work in the following cases.

  • Your query does not have an include element

  • If you do have an include element, you only specify fields from the primary domain in it.

For example, in the following query, sort, limit and offset will not work because the primary domain is item, but the include element specifies that fields from the artifact, module and build domains should be displayed:

items.find().include("artifact","artifact.module","artifact.module.build")

Using the .limit elements, you can limit the number of records that will be displayed by your query.

// Find all the jars in artifactory and sort them by repo and name, but only display the first 100 results
items.find({"name" : {"$match":"*.jar"}).sort({"$asc" : ["repo","name"]}).limit(100)

You can also implement pagination when you want to focus on a subset of your results using the .offset element.

//Run the same example, but this time, display up to 50 items but skipping the first 100
items.find({"name" : {"$match":"*.jar"}).sort({"$asc" : ["repo","name"]}).offset(100).limit(50)