arangodb/spring-data

[Query]Arangodb nested attribute sorting spring data

Gajanana opened this issue · 2 comments

I have my arango sample record as shown below

{
   "id" : "CNHFDGSH5K",
   "outerstring" : "XTRAVIL"
   "properties" : {
     "name": "ACASE23"
    }
}

Want to Sort by properties.name in Pagination

PageRequest.of(
pagenum - 1,
pageSize,
Sort.by(ASC, String.format("%s.%s", "collectionName", "properties.name")));
Sorting works for if I pass outerstring but it does not work with properties.name

using arangodb-spring-data library version 3.5.1 / spring.data commons 2.7.16 and ArangoRepository

@Gajanana
I tested the above query. If you changed the

PageRequest.of( pagenum - 1, pageSize, Sort.by(ASC, String.format("%s.%s", "collectionName", "properties.name")));
to
PageRequest.of( pagenum - 1, pageSize, Sort.by(ASC, "properties.name"));

No need to pass collectionName additionally.

As clarified by @upadhyaydhiren , the field in the sort clause should not be prefixed with the collection name.

@Gajanana, please reopen in case of further questions.