问题
I'm using Artifactory 3.5. My artifacts have custom properties. I want to be able to query for all artifacts that have that property and I want the result to show the property and its value. I know I can use:
items.find(...).include("property.*")
However, this returns all properties for the item matching the find criteria. How can I display only the specific property that I want?
回答1:
The include element allows you to include only specific properties in the results
For example, the following query results will only include the artifact name and the "artifactory.licenses" property:
items.find({"@artifactory.licenses" : {"$eq" : "MIT"}}).include("name", "@artifactory.licenses")
This will return for example:
{
"results" : [ {
"name" : "connection_pool-2.2.0.gem",
"properties" : [ {
"key" : "artifactory.licenses",
"value" : "MIT"
} ]}
}
来源:https://stackoverflow.com/questions/36755962/artifactory-aql-get-specific-properties