Reputation: 25
So Im using RT AQL to fetch data by filtering repo, app and branch while including custom property and sorting by 'created' sort wont work while Im using 'include' feature for example:
items.find({"repo":"my-repo","@app":"myapp", "@branch": "mybranch"})
.include("@version")
.sort({"$asc" :["created"]}).limit(50)
I would expect to get 1.0.0 (which is ok)
what I actually get: 1.0.0 , 1.0.1, 1.0.2, 1.0.3
but if I change the order to use desc
.sort({"$desc" :["created"]}).limit(50)
output will be the same
I would expect to get 1.0.3
the order I actually get: 1.0.0 , 1.0.1, 1.0.2, 1.0.3
Only if I remove the include part output will be as expected.
Any ideas?
Upvotes: 0
Views: 852
Reputation: 1851
AQL has a known limitation with sort, limit and offset, which appears under the Usage section in the documentation:
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")
Upvotes: 3